0

我有一段代码可以从连接到我的计算机的电话中读取消息。该代码是我复制的代码,它总是给我这两个错误,有时它会说:

无法将类型为“GsmComm.GsmCommunication.GsmPhone”的对象转换为类型“System.ComponentModel.ISynchronizeInvoke”。(System.invlaid.Exception)

感谢帮助

private void btnRead_Click(object sender, RoutedEventArgs e)
{
    Mouse.OverrideCursor = Cursors.Wait;

    string storage = GetMessageStorageReading();

    try
    {
        DecodedShortMessage[] messages = CommSetting.comm.ReadMessages(PhoneMessageStatus.All, storage);

        foreach (DecodedShortMessage message in messages)
        {
            OutputReading(string.Format("Statut du message = {0}, Emplacement = {1}/{2}",
            StatusToString(message.Status), message.Storage, message.Index));
            ShowMessageReading(message.Data);
            OutputReading("");
        }

        OutputReading(string.Format("{0,9} message(s) lu(s).", messages.Length.ToString()));
        OutputReading("");
    }

    catch (Exception ex)
    {
        ShowException(ex);
    }

    Mouse.OverrideCursor = null;
}
4

0 回答 0