Beispiel #1
0
 private void btnConnectionControl_Click(object sender, EventArgs e)
 {
     if (btnConnectionControl.Text.Equals(CONNECT_UART_STRING_ON_BUTTON, StringComparison.Ordinal)) // Check if button is showing "Connect" at this moment.
     {                                                                                              // User to connect
         string curItem = lstSerialComPort.SelectedItem.ToString();
         if (MySerialPort.OpenPort(curItem) == true)
         {
             //BlueRat_UART_Exception_status = false;
             UpdateToDisconnectButton();
             DisableRefreshCOMButton();
             tmr_FetchingUARTInput.Enabled = true;
         }
         else
         {
             // Error message
         }
     }
     else
     {   // User to disconnect
         if (MySerialPort.ClosePort() == true)
         {
             UpdateToConnectButton();
             EnableRefreshCOMButton();
             // if (BlueRat_UART_Exception_status) { Serial_UpdatePortName(); }
             //BlueRat_UART_Exception_status = false;
         }
         else
         {
             // Error message
         }
         tmr_FetchingUARTInput.Enabled = false;
     }
 }