Beispiel #1
0
 private void ReadPwrParam(object sender, RoutedEventArgs e)
 {
     if (((Button)sender).Name == "PwrCh0Read")
     {
         PwrSerial.GetChanellData(0);
     }
     if (((Button)sender).Name == "PwrCh1Read")
     {
         PwrSerial.GetChanellData(1);
     }
     if (((Button)sender).Name == "PwrCh2Read")
     {
         PwrSerial.GetChanellData(2);
     }
     if (((Button)sender).Name == "PwrCh3Read")
     {
         PwrSerial.GetChanellData(3);
     }
     if (((Button)sender).Name == "PwrCh4Read")
     {
         PwrSerial.GetChanellData(4);
     }
     if (((Button)sender).Name == "PwrCh5Read")
     {
         PwrSerial.GetChanellData(5);
     }
 }
Beispiel #2
0
        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;
            }
        }
Beispiel #3
0
 private void ReadPwrParam(object sender, RoutedEventArgs e)
 {
     if (((Button)sender).Name == "PwrCh1Read")
     {
         PwrSerial.GetChanellData(1);
     }
 }
Beispiel #4
0
        private void PwrCanelOn(object sender, RoutedEventArgs e)
        {
            if (LogBox != null)
            {
                switch (((ToggleButton)sender).Name)
                {
                case "PwrCh0Check":
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = "Включен канал 0"
                    });
                    PwrSerial.SetChannelOn(0);
                    break;

                case "PwrCh1Check":
                    PwrSerial.SetChannelOn(1);
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = "Включен канал 1"
                    });
                    break;

                case "PwrCh2Check":
                    PwrSerial.SetChannelOn(2);
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = "Включен канал 2"
                    });
                    break;

                case "PwrCh3Check":
                    PwrSerial.SetChannelOn(3);
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = "Включен канал 3"
                    });
                    break;

                case "PwrCh4Check":
                    PwrSerial.SetChannelOn(4);
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = "Включен канал 4"
                    });
                    break;

                case "PwrCh5Check":
                    PwrSerial.SetChannelOn(5);
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = "Включен канал 5"
                    });
                    break;

                default:
                    PwrSerial.SetChannelOn(9);
                    break;
                }
            }
        }
Beispiel #5
0
        public MainWindow()
        {
            InitializeComponent();
            LogBox.Items.Add(new LogBoxItem {
                Dt = DateTime.Now, LogText = "Приложение запущено"
            });
            InitInternalComponents();

            _pwrSerial   = new PwrSerial(CbPowerPort.Text);
            _pumpSerial  = new PumpSerial(CbPumpPort.Text, Properties.Settings.Default.PumpReverse, AddLogBoxMessage);
            dispSerial   = new Dispencer.DispSerial(CbDispenserPort.Text, AddLogBoxMessage, DispathData);
            _pyroSerial  = new PyroSerial(CbPyroPort.Text);
            _laserSerial = new LaserSerial(CbLaserPort.Text);
            _laserSerial.SetLaserType(Properties.Settings.Default.LaserType);
            DataContext = this;
        }
Beispiel #6
0
 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);
 }