Example #1
0
 // Click "Exit" on ContextMenu
 private static void ExitApplication(object sender, EventArgs e)
 {
     if (Configure != null)
     {
         Configure.Dispose();
     }
     //
     if (About != null)
     {
         About.Dispose();
     }
     //
     if (IrdaComPort.isOpen)
     {
         IrdaComPort.Close();
     }
     //
     tmrProgram.Enabled = false;
     tmrProgram.Dispose();
     //
     IrdaContextMenu.Dispose();
     IrdaNotifyIcon.Dispose();
     //
     Application.Exit();
 }
Example #2
0
 // Button Open/Close Click
 private void btPortOpenClose_MouseClick(object sender, MouseEventArgs e)
 {
     if (ComPort.isOpen)
     {
         tmrConfigure.Enabled = false;
         tbReceive.Clear();
         ComPort.Close();
         btPortOpenClose.Text = "Open";
         gbPortName.Enabled   = true;
     }
     else
     {
         ComPort.Open();
         if (ComPort.isOpen)
         {
             tmrConfigure.Enabled = true;
             btPortOpenClose.Text = "Close";
             gbPortName.Enabled   = false;
         }
         else
         {
             StatusLabel.ForeColor = Color.Red;
         }
     }
     StatusLabel.Text = "Port " + ComPort.Name + " " + ComPort.Status;
 }