Receiving the same message twice

元气小坏坏 提交于 2019-12-25 09:07:38

问题


Hey i'm building a skypebot and i can't figure out why i'm receiving the message 2x

This is the code im using

        private void Form1_Load(object sender, EventArgs e)
    {
        client = new Skype();
        client.MessageStatus += Client_MessageStatus;
        AttachToSkype();
    }
        private void Client_MessageStatus(ChatMessage pMessage, TChatMessageStatus Status)
    {
        MessageBox.Show(pMessage.Sender.Handle + " Says: " + pMessage.Body);
    }

Thanks for your time -Tristan


回答1:


MessageStatus event is called every time message's status has been changed.
You need check for TChatMessageStatus. It should be cmsReceived.

private static void Skype_MessageStatus(ChatMessage pMessage, TChatMessageStatus Status)
{
       if (Status != TChatMessageStatus.cmsReceived) return;

       MessageBox.Show(pMessage.Sender.Handle + " Says: " + pMessage.Body);
}


来源:https://stackoverflow.com/questions/39058352/receiving-the-same-message-twice

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!