コード例 #1
0
        public bool Add(CameraWindow camwin, DeviceInfo deviceInfo, CameraInfo camera)
        {
            // create video source

            IVideoSource videoSource = DeviceBusiness.Instance.CreateVideoSource(deviceInfo.ProviderName);
            if (videoSource == null)
            {
                return false;
            }
            DeviceDriver device = new DeviceDriver(videoSource);

            if (!RunningDeviceList.ContainsKey(deviceInfo.DeviceId))
            {
                deviceInfo.ServiceID = -1;
                device.Init(ref deviceInfo);
                RunningDeviceList.Add(deviceInfo.DeviceId, deviceInfo);
                RunningDriverList.Add(camera.CameraId, device);

            }
            else
            {
                deviceInfo = RunningDeviceList[deviceInfo.DeviceId];
                device.Init(ref deviceInfo);

                RunningDriverList.Add(camera.CameraId, device);
            }

            device.Start(ref camera);
               // camwin.Camera = device;
            return true;
        }
コード例 #2
0
ファイル: Multiplexer.cs プロジェクト: ewin66/intvideosurv
        private void SetClickON(CameraWindow cameraWindow)
        {
            Graphics  g  = this.CreateGraphics();
            Rectangle rc = cameraWindow.ClientRectangle;
            Pen       pen;
            string    winName = "cameraWindow";

            for (int i = 1; i <= 25; i++)
            {
                Control[] control = this.Controls.Find(string.Format("{0}{1}", winName, i), false);
                if (control.Length > 0)
                {
                    CameraWindow ctr = (CameraWindow)control[0];

                    if (ctr != null && ctr.Visible && ctr.Name != cameraWindow.Name)
                    {
                        ctr.ClickMe = false;
                        pen         = new Pen(Color.White, 3);
                        g.DrawRectangle(pen, ctr.Location.X - 1, ctr.Location.Y - 1, ctr.Width + 2, ctr.Height + 2);
                    }
                }
            }
            this.SuspendLayout();
            pen = new Pen(Color.Green, 3);
            g.DrawRectangle(pen, cameraWindow.Location.X - 1, cameraWindow.Location.Y - 1, rc.Width + 2, rc.Height + 2);
            cameraWindow.ClickMe = true;
            this.ResumeLayout(false);
        }
コード例 #3
0
        public bool Add(CameraWindow camwin, DeviceInfo deviceInfo, CameraInfo camera)
        {
            // create video source

            IVideoSource videoSource = DeviceBusiness.Instance.CreateVideoSource(deviceInfo.ProviderName);

            if (videoSource == null)
            {
                return(false);
            }
            DeviceDriver device = new DeviceDriver(videoSource);

            if (!RunningDeviceList.ContainsKey(deviceInfo.DeviceId))
            {
                deviceInfo.ServiceID = -1;
                device.Init(ref deviceInfo);
                RunningDeviceList.Add(deviceInfo.DeviceId, deviceInfo);
                RunningDriverList.Add(camera.CameraId, device);
            }
            else
            {
                deviceInfo = RunningDeviceList[deviceInfo.DeviceId];
                device.Init(ref deviceInfo);

                RunningDriverList.Add(camera.CameraId, device);
            }

            device.Start(ref camera);
            // camwin.Camera = device;
            return(true);
        }
コード例 #4
0
ファイル: Multiplexer.cs プロジェクト: ewin66/intvideosurv
 private void cameraWindow_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     try
     {
         if (!isFullScreen)
         {
             SingleCameraMode = true;
             FitToWindow      = true;
             currentWin       = lastClicked;
         }
         else
         {
             SingleCameraMode   = false;
             currentWin.ClickMe = true;
         }
         doubleClicked = (CameraWindow)sender;
         if (DoubleCamera != null)
         {
             DoubleCamera(!isFullScreen, currentWin.Camera == null ? null : currentWin.Camera.CurrentCamera);
         }
         CurrentCameraWindow = currentWin;
         SetClickON(CurrentCameraWindow);
         isFullScreen = !isFullScreen;
         UpdateSize();
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.ToString());
     }
 }
コード例 #5
0
ファイル: Multiplexer.cs プロジェクト: ewin66/intvideosurv
        public CameraWindow GetCamera(int row, int col)
        {
            CameraWindow rtnCameraWindow = null;

            if ((row >= 0) && (col >= 0) && (row < MaxRows) && (col < MaxCols))
            {
                rtnCameraWindow = camWindows[row, col];
            }
            return(rtnCameraWindow);
        }
コード例 #6
0
ファイル: Multiplexer.cs プロジェクト: ewin66/intvideosurv
 private void cameraWindow_Click(object sender, EventArgs e)
 {
     try
     {
         if (sender != null)
         {
             CurrentCameraWindow = (CameraWindow)sender;
             SetClickON(CurrentCameraWindow);
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #7
0
ファイル: Multiplexer.cs プロジェクト: ewin66/intvideosurv
        public CameraWindow SetCamera(CameraWindow cameraWindow, HikVideoServerCameraDriver camera)
        {
            for (int i = 0; i < MaxRows; i++)
            {
                for (int j = 0; j < MaxCols; j++)
                {
                    if ((camWindows[i, j].Camera != null) && (camWindows[i, j].Camera.CurrentCamera.CameraId == camera.CurrentCamera.CameraId))
                    {
                        camWindows[i, j].Camera = null;
                        camWindows[i, j].Refresh();
                    }
                }
            }

            cameraWindow.Camera = camera;
            cameraWindow.Refresh();
            return(cameraWindow);
        }
コード例 #8
0
 // On mouse down in camera window
 private void cameraWindow_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     lastClicked = (CameraWindow)sender;
 }
コード例 #9
0
        private void SetClickON(CameraWindow cameraWindow)
        {
            Graphics g = this.CreateGraphics();
            Rectangle rc = cameraWindow.ClientRectangle;
            Pen pen;
            string winName = "cameraWindow";
            for (int i = 1; i <= 25; i++)
            {
                Control[] control = this.Controls.Find(string.Format("{0}{1}", winName, i), false);
                if (control.Length > 0)
                {
                    CameraWindow ctr = (CameraWindow)control[0];

                    if (ctr != null&&ctr.Visible&&ctr.Name!=cameraWindow.Name)
                    {
                        ctr.ClickMe = false;
                        pen = new Pen(Color.White, 3);
                        g.DrawRectangle(pen, ctr.Location.X - 1, ctr.Location.Y - 1, ctr.Width + 2, ctr.Height + 2);
                    }
                }

            }
            this.SuspendLayout();
            pen = new Pen(Color.Green, 3);
            g.DrawRectangle(pen, cameraWindow.Location.X - 1, cameraWindow.Location.Y - 1, rc.Width + 2, rc.Height + 2);
            cameraWindow.ClickMe = true;
            this.ResumeLayout(false);
        }
コード例 #10
0
 // On mouse down in camera window
 private void cameraWindow_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     lastClicked = (CameraWindow)sender;
 }
コード例 #11
0
        private void cameraWindow_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (!isFullScreen)
                {
                    SingleCameraMode = true;
                    FitToWindow = true;
                    currentWin = lastClicked;
                }
                else
                {
                    SingleCameraMode = false;
                    currentWin.ClickMe = true;
                }
                doubleClicked = (CameraWindow)sender;
                if (DoubleCamera != null)
                {
                    DoubleCamera(!isFullScreen, currentWin.Camera == null ? null : currentWin.Camera.CurrentCamera);
                }
                CurrentCameraWindow = currentWin;
                SetClickON(CurrentCameraWindow);
                isFullScreen = !isFullScreen;
                UpdateSize();

            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString());
            }
        }
コード例 #12
0
        private void cameraWindow_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    CurrentCameraWindow = (CameraWindow)sender;
                    SetClickON(CurrentCameraWindow);
                }
            }
            catch (Exception ex)
            {

            }
        }
コード例 #13
0
        public CameraWindow SetCamera(CameraWindow cameraWindow, HikVideoServerCameraDriver camera)
        {
            for (int i = 0; i < MaxRows; i++)
            {
                for (int j = 0; j < MaxCols; j++)
                {
                    if ((camWindows[i, j].Camera!=null) && (camWindows[i, j].Camera.CurrentCamera.CameraId == camera.CurrentCamera.CameraId))
                    {
                        camWindows[i, j].Camera = null;
                        camWindows[i, j].Refresh();
                    }
                }
            }

            cameraWindow.Camera = camera;
            cameraWindow.Refresh();
            return cameraWindow;
        }
コード例 #14
0
        private void CaptureImageThread()
        {
            //lock (lockerCurrentImage)
            //{
                try
                {
                    _currentcCameraWindow = mainMultiplexer.GetCurrentCameraWindow();
                    if (_currentcCameraWindow == null)
                    {
                        XtraMessageBox.Show("��ѡ��һ������!");
                        return;
                    }
                    _currentImageIndex = 0;
                    currentGuid = _currentcCameraWindow.CurrentImageGuid;
                    _ImageSerias[_currentImageIndex++] = (Image)(_currentcCameraWindow.CurrentImage.Clone());
                    while (_currentImageIndex < 5)
                    {
                        lock (lockerCurrentImage)
                        {
                            if (currentGuid != _currentcCameraWindow.CurrentImageGuid)
                            {
                                _ImageSerias[_currentImageIndex++] = (Image)(_currentcCameraWindow.CurrentImage.Clone());
                            }
                            Thread.Sleep(77);
                        }

                    }

                    //_ImageSerias[0] = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg");
                    //_ImageSerias[1] = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg");
                    //_ImageSerias[2] = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Koala.jpg");
                    //_ImageSerias[3] = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Tulips.jpg");
                    //_ImageSerias[4] = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg");

                    //���������ã�����ͷID����Ϊ1
                    DelShowDrawingForm delShowDrawingForm  = ShowDrawingForm;
                    this.Invoke(delShowDrawingForm, new object[] { _ImageSerias, _currentcCameraWindow.CameraID });

                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.ToString());
                }
            //}
        }