public CameraCollection(CameraCollection src)
        {
            CameraDictionary = new Dictionary <string, CameraData>();
            if (null != src && null != src.CameraDictionary && null != src.CameraDictionary.Values)
            {
                foreach (var cam in src.CameraDictionary.Values)
                {
                    CameraData newCam = new CameraData(cam);
                    CameraDictionary.Add(CameraData.PathAndPrefix(newCam), newCam);
                    newCam.Init();
                }

                CurrentCameraPath = src.CurrentCameraPath;
            }
        }
Esempio n. 2
0
        // Only called at startup to load the camera data into the listview
        void PopulateControls()
        {
            availableCamerasList.Items.Clear();
            foreach (var cam in AllCameraData.CameraDictionary.Values)
            {
                // Add the camera to the list currently available
                ListViewItem availableItem = new ListViewItem(new string[] { cam.CameraPrefix, cam.Path })
                {
                    Tag = cam
                };

                availableCamerasList.Items.Add(availableItem);

                ListViewItem monitorItem = new ListViewItem(new string[] { cam.CameraPrefix, cam.Path })
                {
                    Tag = cam
                };
                monitorListView.Items.Add(monitorItem);

                if (cam.Monitoring)
                {
                    monitorItem.Checked = true;
                }
            }

            if (SelectedCamera != null)
            {
                cameraIPAddressText.Text       = SelectedCamera.LiveContactData.CameraIPAddress;
                cameraPasswordText.Text        = SelectedCamera.LiveContactData.CameraPassword;
                cameraUserText.Text            = SelectedCamera.LiveContactData.CameraUserName;
                cameraXResolutionNumeric.Value = SelectedCamera.LiveContactData.CameraXResolution;
                cameraYResolutionNumeric.Value = SelectedCamera.LiveContactData.CameraYResolution;
                cameraNameText.Text            = SelectedCamera.LiveContactData.ShortCameraName;
                if (SelectedCamera.NoMotionTimeout > 0)
                {
                    MotionTimeoutNumeric.Value = SelectedCamera.NoMotionTimeout;
                }
            }

            if (null != SelectedCamera)
            {
                int currentIndex = CameraFromList(CameraData.PathAndPrefix(SelectedCamera));
                Debug.Assert(currentIndex >= 0);
                availableCamerasList.Items[currentIndex].Focused  = true;
                availableCamerasList.Items[currentIndex].Selected = true;
                availableCamerasList.Select();
            }
        }
Esempio n. 3
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            if (null != SelectedCamera)
            {
                AllCameraData.CameraDictionary.Clear(); // the data is no longer valid
                foreach (ListViewItem item in availableCamerasList.Items)
                {
                    AllCameraData.AddCamera((CameraData)item.Tag);
                }

                AllCameraData.CurrentCameraPath = CameraData.PathAndPrefix(SelectedCamera);


                // AllCameraData only tracks it by the path, but it is a valid reference to an item on the list
                UpdateCurrentCameraFromLiveView();
            }

            DialogResult = DialogResult.OK;
        }
 public void DeleteCamera(CameraData camData)
 {
     CameraDictionary.Remove(CameraData.PathAndPrefix(camData));
 }
 public void AddCamera(CameraData camData)
 {
     CameraDictionary.Add(CameraData.PathAndPrefix(camData), camData);
 }
Esempio n. 6
0
 // The actual path for monitoring motion images
 public static string WildcardPath(CameraData camera)
 {
     return(CameraData.PathAndPrefix(camera) + "\\*.jpg");
 }
Esempio n. 7
0
 public String Path()
 {
     return(CameraData.PathAndPrefix(cameraData));
 }