示例#1
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     try
     {
         if (btnConnect.Text.ToUpper() == "CONNECT")
         {
             SMSconnection();
             btnSendSMS.Enabled     = false;
             tmrSendSMS.Enabled     = true;
             btnConnect.Text        = "DISCONNECT";
             btnClose.Enabled       = true;
             lbl_phone_status.Text  = "CONNECT";
             btnReceivedSMS.Enabled = true;
             btnSendSMS.Enabled     = true;
         }
         else
         {
             btnConnect.Text        = "CONNECT";
             tmrSendSMS.Enabled     = false;
             btnClose.Enabled       = true;
             btnReceivedSMS.Enabled = true;
             lbl_phone_status.Text  = "DISCONNECT";
             btnClose.Enabled       = true;
             ModemCommunication.Close();
         }
     }
     catch (Exception ex)
     {
         LogFile(ex.Message, e.ToString(), ((Control)sender).Name, this.FindForm().Name);
     }
 }
示例#2
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            Port_Configured();
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                ModemCommunication.Open();
                while (!ModemCommunication.IsConnected())
                {
                    Cursor.Current = Cursors.Default;
                    if (MessageBox.Show(this, "No Phone Connectd.", "Connected Setup", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation) == DialogResult.Cancel)
                    {
                        ModemCommunication.Close();
                        return;
                    }
                    Cursor.Current = Cursors.WaitCursor;
                }
                ModemCommunication.Close();
            }
            catch (Exception ex)
            {
                LogFile(ex.Message, e.ToString(), ((Control)sender).Name, this.FindForm().Name);
                MessageBox.Show(this, "Connection error:" + ex.Message, "Connection Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            MessageBox.Show(this, "Successfully Connection to the phone.", "Connection Setup", MessageBoxButtons.OK, MessageBoxIcon.Information);
            btnConnect.Enabled = true;
        }
示例#3
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     this.Close();
     ModemCommunication.Close();
 }