Exemplo n.º 1
0
        public void MonitorSensor()
        {
            //adam.SetData();

            if ((int)btnStart.Tag == 0)
            {
                if (ipCameraHelper == null)
                {
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        ipCameraHelper = new IpCameraHelper(cameraIp, "admin", "", new Action <ImageEventArgs>(ShowImage));
                    }));
                }

                ipCameraHelper.StartProcessing();

                btnStart.Content = "停止监控";
                btnStart.Tag     = 1;
            }
            else
            {
                if (ipCameraHelper != null)
                {
                    ipCameraHelper.StopProcessing();
                }

                btnStart.Content = "开始监控";
                btnStart.Tag     = 0;
            }
        }
Exemplo n.º 2
0
        public void MonitorSensor()
        {
            if (ipCameraHelper == null)
            {
                this.Dispatcher.Invoke(new Action(() =>
                {
                    ipCameraHelper = new IpCameraHelper("192.168.3.200:80", "admin", "", new Action <ImageEventArgs>(ShowImage));
                }));
            }

            //adam.SetData();

            if (adamDIO == adam.DI0)
            {
                return;
            }

            adamDIO = adam.DI0;

            if (!adamDIO)
            {
                ipCameraHelper.StartProcessing();
            }
            else
            {
                if (ipCameraHelper != null)
                {
                    ipCameraHelper.StopProcessing();
                }
            }

            MonitorSensor();
        }
        public MainWindow()
        {
            InitializeComponent();

            ipCamera = new IpCameraHelper("192.168.3.200:80", "admin", "", new Action <ImageEventArgs>((imageEventArgs) =>
            {
                imgCamera.Source = imageEventArgs.FrameReadyEventArgs.BitmapImage;
            }));

            trdShowCamera = new Thread(new ThreadStart(MonitorLogic));
            trdShowCamera.IsBackground = true;
        }
Exemplo n.º 4
0
 public MainWindow()
 {
     InitializeComponent();
     ipc = new IpCameraHelper("10.96.34.171:80", "admin", "", new Action <ImageEventArgs>((a) => { bit = a.FrameReadyEventArgs.BitmapImage; }));
     ipc.StartProcessing();
     sto.IsEnabled = false;
     gam.IsEnabled = true;
     ti            = new Timer(50);
     ti.Elapsed   += new ElapsedEventHandler(tim1);
     ti2           = new Timer(50);
     ti2.Elapsed  += new ElapsedEventHandler(tim2);
     // ti.BeginInit();
 }