예제 #1
0
        private void btnSendSession_Click(object sender, EventArgs e)
        {
            if (lvSessions.SelectedItems.Count == 0)
            {
                return;
            }

            SimSession    objSession = (SimSession)lvSessions.SelectedItems[0].Tag;
            frmSmsMessage frm        = new frmSmsMessage(objSession, null, frmSmsMessage.EFrmType.SEND, m_objSimModel.MultipartMode, m_objSimModel.UseGsmEncoding);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                SimMessage objMessage = frm.Message;
                objMessage.SessionId = objSession.Id;
                objMessage.SystemId  = objSession.SystemId;

                SimCommand objCommand = new SimCommand();
                objCommand.CommandId = SimCommand.ECommandId.SENDMESSAGE;
                objCommand.Message   = new SimMessage(objMessage);
                objCommand.SessionId = objSession.Id;

                // Sending a new message is a kind of 'fire and forget', this
                // is because the message will be added to the back of the queue
                // in the worker thread. Actually waiting for the message to be
                // submitted to the session for delivery may take a while when
                // doing stress tests.
                m_objSimWorker.PushWorker(objCommand);
            }
        }
예제 #2
0
        private void btnAddAutoMessage_Click(object sender, EventArgs e)
        {
            frmSmsMessage frm = new frmSmsMessage(null, null, frmSmsMessage.EFrmType.CREATE, m_objSimModel.MultipartMode, m_objSimModel.UseGsmEncoding);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                AddToAutoMessage(frm.Message);
            }
            PushAutoMessages();
        }
예제 #3
0
        private void lvMessages_DoubleClick(object sender, EventArgs e)
        {
            if (lvMessages.SelectedItems.Count <= 0)
            {
                return;
            }
            SimMessage objMessage = (SimMessage)lvMessages.SelectedItems[0].Tag;

            // See if I can find an active session for this message as well.
            // It's no problem if it's no longer there.
            SimSession objSession = null;

            ListViewItem[] lvs = lvSessions.Items.Find(objMessage.SessionId.ToString(), false);
            if (lvs.Length > 0)
            {
                objSession = (SimSession)lvs[0].Tag;
            }

            frmSmsMessage frm = new frmSmsMessage(objSession, objMessage, frmSmsMessage.EFrmType.VIEW, m_objSimModel.MultipartMode, m_objSimModel.UseGsmEncoding);

            // if it's a multipart message, try to find the rest of the parts as well
            if (objMessage.TotalParts > 1)
            {
                var lsParts = new List <SimMessage>();
                foreach (ListViewItem lvi in lvMessages.Items)
                {
                    SimMessage objPart = (SimMessage)lvi.Tag;
                    if (objPart.TotalParts > 1 &&
                        objPart.MultipartReference == objMessage.MultipartReference &&
                        objPart.Direction == objMessage.Direction)
                    {
                        lsParts.Add(objPart);
                        if (lsParts.Count == objMessage.TotalParts)
                        {
                            break;
                        }
                    }
                }
                frm.Parts = lsParts;
            }

            frm.ShowDialog();
        }
예제 #4
0
        private void btnEditAutoMessage_Click(object sender, EventArgs e)
        {
            if (lvAutoMessage.SelectedItems.Count <= 0)
            {
                return;
            }

            SimMessage    objMessage = (SimMessage)lvAutoMessage.SelectedItems[0].Tag;
            frmSmsMessage frm        = new frmSmsMessage(null, objMessage, frmSmsMessage.EFrmType.EDIT, m_objSimModel.MultipartMode, m_objSimModel.UseGsmEncoding);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                ListViewItem lvi = lvAutoMessage.SelectedItems[0];
                lvi.SubItems[AUTOMESSAGE_FROMADDRESS].Text = objMessage.FromAddress;
                lvi.SubItems[AUTOMESSAGE_TOADDRESS].Text   = objMessage.ToAddress;
                lvi.SubItems[AUTOMESSAGE_BODY].Text        = objMessage.Body;
            }
            PushAutoMessages();
        }