//當re232有變化的時候這邊會接收到 private void rs232Timer_Tick(object sender, EventArgs e) { Console.WriteLine("CHANGE"); if (rs232.Check_ComPort_LinkStatus() == false) { if (rs232.Open_ComPort(cb_ComPort.Text, cb_Baudrate.Text) == true) { lb_LinkStatus.Content = "Link OK !"; lb_LinkStatus.Foreground = Brushes.Green; isConnectComPort = true; } else { lb_LinkStatus.Content = "Link Fail !"; lb_LinkStatus.Foreground = Brushes.Red; isConnectComPort = false; } } if (rs233.Check_ComPort_LinkStatus() == false) { if (rs233.Open_ComPort(cb_ComPort_Copy.Text, cb_Baudrate.Text) == true) { lb_LinkStatus_Copy.Content = "Link OK !"; lb_LinkStatus_Copy.Foreground = Brushes.Green; isConnectComPort = true; } else { lb_LinkStatus_Copy.Content = "Link Fail !"; lb_LinkStatus_Copy.Foreground = Brushes.Red; isConnectComPort = false; } } if (rs234.Check_ComPort_LinkStatus() == false) { if (rs234.Open_ComPort(cb_ComPort_Copy1.Text, cb_Baudrate.Text) == true) { lb_LinkStatus_Copy1.Content = "Link OK !"; lb_LinkStatus_Copy1.Foreground = Brushes.Green; isConnectComPort = true; } else { lb_LinkStatus_Copy1.Content = "Link Fail !"; lb_LinkStatus_Copy1.Foreground = Brushes.Red; isConnectComPort = false; } } }