Beispiel #1
0
 private void AddCamera(int videoSourceIndex, bool startWizard = false)
 {
     CameraWindow cw = NewCameraWindow(videoSourceIndex);
     TopMost = false;
     var ac = new AddCamera { CameraControl = cw, StartWizard = startWizard, IsNew = true, MainClass = this };
     ac.ShowDialog(this);
     if (ac.DialogResult == DialogResult.OK)
     {
         UnlockLayout();
         SetNewStartPosition();
         if (cw.VolumeControl != null && !cw.VolumeControl.IsEnabled)
             cw.VolumeControl.Enable();
         NeedsSync = true;
     }
     else
     {
         int cid = cw.Camobject.id;
         cw.Disable();
         _pnlCameras.Controls.Remove(cw);
         cw.Dispose();
         Cameras.RemoveAll(p => p.id == cid);
     }
     ac.Dispose();
     TopMost = Conf.AlwaysOnTop;
 }
Beispiel #2
0
        internal void EditCamera(objectsCamera cr)
        {
            int cameraId = Convert.ToInt32(cr.id);
            CameraWindow cw = null;

            for (int index = 0; index < _pnlCameras.Controls.Count; index++)
            {
                Control c = _pnlCameras.Controls[index];
                if (c.GetType() != typeof(CameraWindow)) continue;
                var cameraControl = (CameraWindow)c;
                if (cameraControl.Camobject.id == cameraId)
                {
                    cw = cameraControl;
                    break;
                }
            }

            if (cw == null) return;
            TopMost = false;
            var ac = new AddCamera { CameraControl = cw };
            ac.ShowDialog(this);
            ac.Dispose();
            TopMost = MainForm.Conf.AlwaysOnTop;
        }
Beispiel #3
0
        internal void EditCamera(objectsCamera cr, IWin32Window owner = null)
        {
            int cameraId = Convert.ToInt32(cr.id);
            CameraWindow cw = null;

            for (int index = 0; index < _pnlCameras.Controls.Count; index++)
            {
                Control c = _pnlCameras.Controls[index];
                if (c.GetType() != typeof(CameraWindow)) continue;
                var cameraControl = (CameraWindow)c;
                if (cameraControl.Camobject.id == cameraId)
                {
                    cw = cameraControl;
                    break;
                }
            }

            if (cw == null) return;
            var ac = new AddCamera { CameraControl = cw, MainClass = this };
            ac.ShowDialog(owner ?? this);
            ac.Dispose();
        }
Beispiel #4
0
        internal void AddCamera(int videoSourceIndex, bool startWizard = false)
        {
            CameraWindow cw = NewCameraWindow(videoSourceIndex);
            TopMost = false;
            var ac = new AddCamera { CameraControl = cw, StartWizard = startWizard, IsNew = true };
            ac.ShowDialog(this);
            if (ac.DialogResult == DialogResult.OK)
            {
                MainForm.Conf.LockLayout = false;
                string path = MainForm.Conf.MediaDirectory + "video\\" + cw.Camobject.directory + "\\";
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);
                path = MainForm.Conf.MediaDirectory + "video\\" + cw.Camobject.directory + "\\thumbs\\";
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);

                path = MainForm.Conf.MediaDirectory + "video\\" + cw.Camobject.directory + "\\grabs\\";
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);

                SetNewStartPosition();
                if (cw.VolumeControl != null && !cw.VolumeControl.IsEnabled)
                    cw.VolumeControl.Enable();
                MainForm.NeedsSync = true;
            }
            else
            {
                int cid = cw.Camobject.id;
                cw.Disable();
                _pnlCameras.Controls.Remove(cw);
                cw.Dispose();
                MainForm.Cameras.RemoveAll(p => p.id == cid);
            }
            ac.Dispose();
            TopMost = MainForm.Conf.AlwaysOnTop;
        }