Example #1
0
 private void TbTwoPumpToggle()
 {
     if (Properties.Settings.Default.IsTwoPump)
     {
         TbTwoPump.Text = "Два насоса";
         if (TbFirstPump != null)
         {
             TbFirstPump.Text = "Порт притока";
         }
         if (TbSecondPump != null)
         {
             TbSecondPump.Visibility = Visibility.Visible;
         }
         if (CbPumpSecondPort != null)
         {
             CbPumpSecondPort.Visibility = Visibility.Visible;
         }
         if (_pumpSecondSerial == null && CbPumpSecondPort != null)
         {
             _pumpSecondSerial = new PumpSerial(CbPumpSecondPort.Text, Properties.Settings.Default.PumpSecondReverse, AddLogBoxMessage);
         }
         if (ExPerforate != null)
         {
             ExPerforate.Visibility = Visibility.Visible;
         }
         if (GrPumpInfo != null)
         {
             GrPumpInfo.RowDefinitions[1].Height = new GridLength(30, GridUnitType.Pixel);
             ElSecondPumpIsOn.Visibility         = Visibility.Visible;
         }
     }
     else
     {
         TbTwoPump.Text = "Один насос";
         if (TbFirstPump != null)
         {
             TbFirstPump.Text = "Порт насоса";
         }
         if (TbSecondPump != null)
         {
             TbSecondPump.Visibility = Visibility.Collapsed;
         }
         if (CbPumpSecondPort != null)
         {
             CbPumpSecondPort.Visibility = Visibility.Collapsed;
         }
         if (ExPerforate != null)
         {
             ExPerforate.Visibility = Visibility.Collapsed;
         }
         if (GrPumpInfo != null)
         {
             GrPumpInfo.RowDefinitions[1].Height = new GridLength(0, GridUnitType.Pixel);
             ElSecondPumpIsOn.Visibility         = Visibility.Collapsed;
         }
     }
 }
Example #2
0
        private void PumpPortOn(object sender, RoutedEventArgs e)
        {
            PumpActive = true;
            if (f_ConfocalTimer == null)
            {
                f_ConfocalTimer = new Timer
                {
                    Interval = 2000
                };
                //_confocalTimer.Elapsed += PeackInfo;
                //Временно закомментировано, во избежание многоразовой подписки на событие
            }
            f_ConfocalTimer.Start();
            if (!_pumpSerial.Active)
            {
                try
                {
                    _pumpSerial.OpenPort();
                }
                catch (Exception ex)
                {
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = ex.Message
                    });
                    CbPumpActive.IsChecked = false;
                }
                try
                {
                    if (IsTwoPump)
                    {
                        if (_pumpSecondSerial == null)
                        {
                            _pumpSecondSerial = new PumpSerial(CbPumpSecondPort.Text, Properties.Settings.Default.PumpSecondReverse, AddLogBoxMessage);
                        }
                        _pumpSecondSerial.OpenPort();
                    }
                }
                catch (Exception ex)
                {
                    LogBox.Items.Insert(0, new LogBoxItem {
                        Dt = DateTime.Now, LogText = ex.Message
                    });
                    CbPumpActive.IsChecked = false;
                }
            }

            if (!IsTwoPump)
            {
                return;
            }
            //Тут указываются начальные направления насосов
            _pumpSerial.AddCounterClockwiseDirection();
            _pumpSecondSerial?.AddClockwiseDirection();
        }
Example #3
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;
        }