Example #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);
            }
        }
Example #2
0
        private void MessageReceived(DecodedShortMessage message)
        {
            var data = message.Data as SmsDeliverPdu;

            foreach (var participantAnswer in _round.ParticipantAnswers)
            {
                if (participantAnswer.Participant.PhoneNumber == data.OriginatingAddress)
                {
                    string messageText = message.Data.UserDataText;
                    foreach (var answer in _round.Question.AvailableAnswers)
                    {
                        if (string.Compare(answer.Letter, messageText, true) == 0)
                        {
                            participantAnswer.Answer = answer;
                            break;
                        }
                    }
                }
            }
        }
        private void MessageReceived(DecodedShortMessage message)
        {
            var data = message.Data as SmsDeliverPdu;

            bool found = false;

            foreach (var participant in _quiz.Participants)
            {
                if (participant.PhoneNumber == data.OriginatingAddress)
                {
                    found            = true;
                    participant.Name = Regex.Replace(data.UserDataText, "\\s+", " ");
                }
            }
            if (!found)
            {
                var participant = new Participant();
                participant.Name        = Regex.Replace(data.UserDataText, "\\s+", " ");
                participant.PhoneNumber = data.OriginatingAddress;
                _quiz.Participants.Add(participant);
            }
        }
Example #4
0
        void MessageReceived(DecodedShortMessage msg)
        {
            var d = (SmsDeliverPdu)msg.Data;

            Output("SMS IN", d.OriginatingAddress, d.UserDataText);
        }