0
votes

I'm just messing around with the skype4com api in c# and I'm a bit confused on how to mute skype with the api. I get an error on the line "skype.Mute = true;"

error:

Error   1   Ambiguity between 'SKYPE4COMLib.ISkype.Mute' and   'SKYPE4COMLib._ISkypeEvents_Event.Mute'  C:\Users\derp\documents\visual studio   2010\Projects\SkypeBot\SkypeBot\Form1.cs    33  39  SkypeBot

code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SKYPE4COMLib;

namespace SkypeBot
{
public partial class Form1 : Form
{            
    public Skype skype = new Skype();
    public bool afk;
    public Form1()
    {
        InitializeComponent();
        ((_ISkypeEvents_Event)skype).MessageStatus += OnMessageStatus;
        skype.Attach(8);
    }
    void OnMessageStatus(ChatMessage msg, TChatMessageStatus status)
    {
            if (status.ToString() == "cmsSending" && msg.Sender.DisplayName == skype.CurrentUser.DisplayName)
            {
                if (msg.Body == "!afk")
                {
                        afk = !afk;
                        if (afk)
                        {
                            msg.Body = msg.Sender.FullName + " is now afk!";

the following line is the issue:

                            skype.Mute = true;
                        }
                        else
                        {
                            msg.Body = msg.Sender.FullName + " has returned!";
                        }
            }
        }
    }
}
}
1
Isn't the property read-only by any chance?cheesemacfly
Oh I'm sorry, completely forgot the error -.- pcbx.us/zachrip/lgk.pngZachrip
Have you tried ((ISkype)skype).Mute = true; ?Simon Whitehead

1 Answers

1
votes

I do not have the Skype API at hand, but it seems that the Skype class implements two interfaces that support a Mute property.

Try casting the reference to a specific interface, and then calling the method, like:

((ISkype)skype).Mute = true;

or

((_ISkypeEvents_Event)skype).Mute = true;