예제 #1
0
        private void comm_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            try
            {
                IMessageIndicationObject obj = e.IndicationObject;
                if (obj is MemoryLocation)
                {
                    MemoryLocation loc    = (MemoryLocation)obj;
                    string         logmsg = string.Format("New message received in storage \"{0}\", index {1}.", loc.Storage, loc.Index);

                    logger(logmsg);

                    DecodedShortMessage msg = comm.ReadMessage(loc.Index, loc.Storage);
                    ShowMessage(msg.Data);
                    return;
                }

                if (obj is ShortMessage)
                {
                    ShortMessage msg = (ShortMessage)obj;
                    SmsPdu       pdu = comm.DecodeReceivedMessage(msg);
                    logger("New message received:");
                    ShowMessage(pdu);

                    return;
                }
                logger("Error: Unknown notification object!");
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }
        }
예제 #2
0
 private void comm_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     try
     {
         IMessageIndicationObject obj = e.IndicationObject;
         if (obj is MemoryLocation)
         {
             MemoryLocation loc = (MemoryLocation)obj;
             Output(string.Format("New message received in storage \"{0}\", index {1}.",
                                  loc.Storage, loc.Index));
             Output("");
             return;
         }
         if (obj is ShortMessage)
         {
             ShortMessage msg = (ShortMessage)obj;
             SmsPdu       pdu = comm.DecodeReceivedMessage(msg);
             Output("New message received.");
             Output("");
             ShowMessage(pdu);
             return;
         }
         Output("Error: Unknown notification object!");
     }
     catch (Exception ex)
     {
         Output(ex.ToString());
     }
 }
예제 #3
0
 private void comm_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     try
     {
         IMessageIndicationObject obj = e.IndicationObject;
         if (obj is ShortMessage)
         {
             ShortMessage msg = (ShortMessage)obj;
             SmsPdu       pdu = comm.DecodeReceivedMessage(msg);
             ReceiveMessage(pdu);
             return;
         }
         MessageBox.Show("Error: Unknown notification object!");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #4
0
 private void comm_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     try
     {
         IMessageIndicationObject obj = e.IndicationObject;
         if (obj is GsmComm.GsmCommunication.ShortMessage)
         {
             GsmComm.GsmCommunication.ShortMessage msg = (GsmComm.GsmCommunication.ShortMessage)obj;
             SmsPdu pdu = comm.DecodeReceivedMessage(msg);
         }
         if (obj is MemoryLocation)
         {
             MemoryLocation loc = (MemoryLocation)obj;
             //statusBar1.Text = "New message received in storage "+loc.Storage + ", index " + loc.Index;
         }
         Read_message();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
 }
예제 #5
0
        private void comm_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            var obj = e.IndicationObject;

            if (obj is MemoryLocation)
            {
                var loc = (MemoryLocation)obj;

                var msg = string.Format("New message received in storage \"{0}\", index {1}.",
                                        loc.Storage, loc.Index);
                MessageBox.Show(msg);

                return;
            }

            if (obj is ShortMessage)
            {
                var msg = (ShortMessage)obj;
                var pdu = comm.DecodeReceivedMessage(msg);

                MessageBox.Show("New message received");
            }
        }