/// <summary> /// 初始化设备 /// </summary> private void InitDevices() { zigBeeDeivce = new ZigBee(new ZigBeeLibrary.ComSettingModel { ZigbeeCom = "COM29" }); zigBeeDeivce.InitSerialPort(); zigBeeDeivce.Open(); //adamDevices = new ADAM4150(new DigitalLibrary.ComSettingModel { DigitalQuantityCom = "COM19" }); //adamDevices.InitSerialPort(); //adamDevices.Open(); //try //{ // string[] port = SerialPort.GetPortNames(); // if (port.Length <= 0) // { // return; // } adamDevices = new Common.DevicesOperate.ADAM4150("COM4"); adamDevices.Open(); //} //catch (Exception e) //{ // return; //} ledPlayer = new LEDPlayer("COM28"); //ledPlayer.InitSerialPort(); ledPlayer.Open(); }
private void checkBox_Click(object sender, RoutedEventArgs e) { if (checkBox.IsChecked.Value) { zigBee.Open(); isZ = true; adam.Open(); isA = true; } else { isZ = false; zigBee.Close(); isA = true; adam.Close(); } }