private void PwrChannelOff(object sender, RoutedEventArgs e) { switch (((CheckBox)sender).Name) { case "PwrCh0Check": PwrSerial.SetChannelOff(0); break; case "PwrCh1Check": PwrSerial.SetChannelOff(1); break; case "PwrCh2Check": PwrSerial.SetChannelOff(2); break; case "PwrCh3Check": PwrSerial.SetChannelOff(3); break; case "PwrCh4Check": PwrSerial.SetChannelOff(4); break; case "PwrCh5Check": PwrSerial.SetChannelOff(5); break; default: PwrSerial.SetChannelOff(9); break; } }
private void PwrChannelOff(object sender, RoutedEventArgs e) { switch (((ToggleButton)sender).Name) { case "PwrCh0Check": PwrSerial.SetChannelOff(0); LogBox.Items.Insert(0, new LogBoxItem { Dt = DateTime.Now, LogText = "Выключен канал 0" }); break; case "PwrCh1Check": PwrSerial.SetChannelOff(1); LogBox.Items.Insert(0, new LogBoxItem { Dt = DateTime.Now, LogText = "Выключен канал 1" }); break; case "PwrCh2Check": PwrSerial.SetChannelOff(2); LogBox.Items.Insert(0, new LogBoxItem { Dt = DateTime.Now, LogText = "Выключен канал 2" }); break; case "PwrCh3Check": PwrSerial.SetChannelOff(3); LogBox.Items.Insert(0, new LogBoxItem { Dt = DateTime.Now, LogText = "Выключен канал 3" }); break; case "PwrCh4Check": PwrSerial.SetChannelOff(4); LogBox.Items.Insert(0, new LogBoxItem { Dt = DateTime.Now, LogText = "Выключен канал 4" }); break; case "PwrCh5Check": PwrSerial.SetChannelOff(5); LogBox.Items.Insert(0, new LogBoxItem { Dt = DateTime.Now, LogText = "Выключен канал 5" }); break; default: PwrSerial.SetChannelOff(9); break; } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //Save Settings Properties.Settings.Default.PwrModeCh0 = CbModeCh0.SelectedIndex; Properties.Settings.Default.PwrModeCh1 = CbModeCh1.SelectedIndex; Properties.Settings.Default.PwrModeCh2 = CbModeCh2.SelectedIndex; Properties.Settings.Default.PwrModeCh3 = CbModeCh3.SelectedIndex; Properties.Settings.Default.PwrModeCh4 = CbModeCh4.SelectedIndex; Properties.Settings.Default.PwrModeCh5 = CbModeCh5.SelectedIndex; Properties.Settings.Default.DispSignalType = CbDispSignalType.SelectedIndex; Properties.Settings.Default.PwrPortIndex = GetPortSelection(CbPowerPort); Properties.Settings.Default.ArduinoPortIndex = GetPortSelection(CbArduinoPort); Properties.Settings.Default.MirrorPortIndex = GetPortSelection(CbMirrorPort); Properties.Settings.Default.LvlPortIndex = GetPortSelection(CbPumpPort); Properties.Settings.Default.DispencerPortIndex = GetPortSelection(CbDispenserPort); Properties.Settings.Default.LvlSecondPortIndex = GetPortSelection(CbPumpSecondPort); Properties.Settings.Default.LaserPortIndex = GetPortSelection(CbLaserPort); Properties.Settings.Default.LaserType = CbLaserType.SelectedIndex; Properties.Settings.Default.CameraType = CbCamType.SelectedIndex; Properties.Settings.Default.AndorMode = CbAndorMode.SelectedIndex; Properties.Settings.Default.DispCurrentChannel = CbDispCurrentChannel.SelectedIndex; //Properties.Settings.Default.PyroPortIndex = 8; Properties.Settings.Default.PyroPortIndex = GetPortSelection(CbPyroPort); Properties.Settings.Default.CameraSavePath = tbSaveCamPath.Text; Properties.Settings.Default.CameraSavePrefix = tbSaveCamPrefix.Text; Properties.Settings.Default.CameraFrameMaxCount = tbFrameCount.Text; Properties.Settings.Default.Save(); if (!(_laserSerial is null)) { _laserSerial.SetOff(); _laserSerial.ClosePort(); } PwrSerial.SetChannelOff(0); Thread.Sleep(100); PwrSerial.SetChannelOff(1); Thread.Sleep(100); PwrSerial.SetChannelOff(2); Thread.Sleep(100); PwrSerial.SetChannelOff(3); Thread.Sleep(100); PwrSerial.SetChannelOff(4); Thread.Sleep(100); PwrSerial.SetChannelOff(5); Thread.Sleep(100); }