我只是在 c# 中使用 skype4com api,我对如何使用 api 使 skype 静音有点困惑。我在“skype.Mute = true;”行收到错误消息
错误:
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
代码:
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!";
以下行是问题:
skype.Mute = true;
}
else
{
msg.Body = msg.Sender.FullName + " has returned!";
}
}
}
}
}
}