Exemple #1
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 AddCameraForm { CameraControl = cw };
            ac.ShowDialog(this);
            ac.Dispose();
            TopMost = Conf.AlwaysOnTop;
        }
Exemple #2
0
        private void AddCamera(int videoSourceIndex, bool startWizard)
        {
            CameraWindow cw = NewCameraWindow(videoSourceIndex);
            TopMost = false;
            var ac = new AddCameraForm { CameraControl = cw, StartWizard = startWizard, IsNew = true };
            ac.ShowDialog(this);
            if (ac.DialogResult == DialogResult.OK)
            {
                UnlockLayout();
                string path = Conf.MediaDirectory + "video\\" + cw.Camobject.directory + "\\";
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);
                path = Conf.MediaDirectory + "video\\" + cw.Camobject.directory + "\\thumbs\\";
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);

                path = 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();
                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;
        }