Пример #1
0
 private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
 {
     var timer = new Timer(_sender =>
     {
         var equipment = new ADAM4150(new ComSettingModel());
         if (equipment.CheckSerialPort(equipment.ADAM4017Provider).Status == RunStatus.Success)
         {
             equipment.SetData();
             Application.Current.Dispatcher.Invoke(() =>
             {
                 Fire.Background         = equipment.fireValue ? Brushes.Tomato : Brushes.CornflowerBlue;
                 Smoke.Background        = equipment.smokeValue ? Brushes.Tomato : Brushes.CornflowerBlue;
                 BodyInfrared.Background = equipment.bodyInfraredValue
                         ? Brushes.Tomato
                         : Brushes.CornflowerBlue;
             });
         }
     }, null, 100, 1000);
 }
Пример #2
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var exHelper = new ExhibitionHelper(exhibitionLight, catchThief, policemen, haveThief, this, imgDoor.Name, imgDoor.Name);

            LazyTimer timer = new LazyTimer(_sender =>
            {
                LazyTimer t = (LazyTimer)_sender[0];
                var statevalue = new ADAM4150(new ComSettingModel());
                if (statevalue.CheckSerialPort(statevalue.ADAM4017Provider).Status ==
                    RunStatus.Failure) return;

                Application.Current.Dispatcher.Invoke(() =>
                {
                    exHelper.OpenAlarm(statevalue.infraredValue);
                });
                t.Reset();
            }, 100, 5000);

            }
Пример #3
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var timer = new Timer(_sender =>
                {
                var equipment = new ADAM4150(new ComSettingModel());
                    if (equipment.CheckSerialPort(equipment.ADAM4017Provider).Status == RunStatus.Success)
                    {
                        equipment.SetData();
                        Application.Current.Dispatcher.Invoke(() =>
                        {
                            Fire.Background = equipment.fireValue ? Brushes.Tomato : Brushes.CornflowerBlue;
                            Smoke.Background = equipment.smokeValue ? Brushes.Tomato : Brushes.CornflowerBlue;
                            BodyInfrared.Background = equipment.bodyInfraredValue
                                ? Brushes.Tomato
                                : Brushes.CornflowerBlue;

                        });
                    }
                },null, 100, 1000);
        }
Пример #4
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var exHelper = new ExhibitionHelper(exhibitionLight, catchThief, policemen, haveThief, this, imgDoor.Name, imgDoor.Name);

            LazyTimer timer = new LazyTimer(_sender =>
            {
                LazyTimer t    = (LazyTimer)_sender[0];
                var statevalue = new ADAM4150(new ComSettingModel());
                if (statevalue.CheckSerialPort(statevalue.ADAM4017Provider).Status ==
                    RunStatus.Failure)
                {
                    return;
                }

                Application.Current.Dispatcher.Invoke(() =>
                {
                    exHelper.OpenAlarm(statevalue.infraredValue);
                });
                t.Reset();
            }, 100, 5000);
        }
Пример #5
0
        private void No1_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            var equipment = new ADAM4150(new ComSettingModel());
            var state     = equipment.CheckSerialPort(equipment.ADAM4017Provider);

            if (state.Status == RunStatus.Success)
            {
                if (Global.ADAM4150Provider.OnOff(no1state ? ADAM4150FuncID.OffSocket1 : ADAM4150FuncID.OnSocket1))
                {
                    no1.Text       = no1state ? "OFF" : "ON";
                    no1.Background = no1state ? Brushes.LightCoral : Brushes.CornflowerBlue;
                    no1state       = !no1state;
                }
                else
                {
                    MessageBox.Show("The Operation is erron");
                }
            }
            else
            {
                MessageBox.Show(state.ResultMessage);
            }
        }
Пример #6
0
        private void No1_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
        var equipment = new ADAM4150(new ComSettingModel());
            var state = equipment.CheckSerialPort(equipment.ADAM4017Provider);
            if (state.Status == RunStatus.Success)
            {
                if (Global.ADAM4150Provider.OnOff( no1state ? ADAM4150FuncID.OffSocket1 : ADAM4150FuncID.OnSocket1 ))
                {
                    no1.Text = no1state ? "OFF" : "ON";
                    no1.Background = no1state ? Brushes.LightCoral : Brushes.CornflowerBlue;
                    no1state = !no1state;
                }
                else
                {
                    MessageBox.Show("The Operation is erron");
                }
            }
            else
            {
                MessageBox.Show(state.ResultMessage);
            }

        }