Beispiel #1
0
        private void cbCameras_SelectedIndexChanged(object sender, EventArgs e)
        {
            currentCamera     = (SecurityCamera)cbCameras.SelectedItem;
            currentCameraName = currentCamera.Name;

            //update UI with camera name
            txtCameraName.Text = currentCameraName;
            tpCameraName.Text  = currentCameraName;
            gbCameraName.Text  = currentCameraName;

            if (isRunning(currentCameraName))
            {
                lblStatus.Text = currentCameraWindow.Status;

                lblCameraCapabilities.Text = currentCameraWindow.GetCameraCapabilities;

                updateCurrentCameraInfo();
            }
            else
            {
                lblStatus.Text = "Stopped";

                lblCameraCapabilities.Text = "Camera must be playing to see capabilities";
            }
        }
Beispiel #2
0
        /// <summary>
        /// record given camera
        /// </summary>
        /// <param name="cameraToRecord"></param>
        public void RecordCamera(SecurityCamera cameraToRecord, bool enableWebInterface)
        {
            CameraDisplay cameraDisplay = null;

            if (cameraToRecord == null)
            {
                MessageBox.Show("You must select a camera to record");
                return;
            }

            if (filters.VideoInputDevices.Count > 0)
            {
                if (isRunning(cameraToRecord.Name))
                {
                    currentCameraWindow.Close();
                }

                int cameraWindowCount = getRunningCameraCount();

                for (int x = 0; x < filters.VideoInputDevices.Count; x++)
                {
                    if (filters.VideoInputDevices[x].MonikerString == cameraToRecord.VideoDevice.MonikerString)//this is the camera to record
                    {
                        saveCameraSettings();

                        cameraDisplay           = new CameraDisplay();
                        cameraDisplay.FrameSize = getFrameSize();
                        cameraDisplay.FTP       = ftp;
                        cameraDisplay.RecordCamera(filters.VideoInputDevices[x], filters.AudioInputDevices[0], recordingPath + cameraToRecord.Name + ".avi", enableWebInterface);

                        cameraDisplay.Show();

                        //position cameraWindow
                        cameraDisplay.Left = cameraWindowCount * 250;
                        cameraDisplay.Top  = 0;

                        cameraDisplay.Text = cameraToRecord.Name;
                        cameraDisplay.Tag  = filters.VideoInputDevices[x].MonikerString;

                        currentCameraWindow = cameraDisplay;

                        lblCameraCapabilities.Text = cameraDisplay.GetCameraCapabilities;

                        break;
                    }
                }
            }
            else
            {
                MessageBox.Show("No Video input devices found");
            }
        }
Beispiel #3
0
        /// <summary>
        /// displays the camera asked for
        /// </summary>
        /// <param name="cameraToStart"></param>
        public void ShowCamera(SecurityCamera cameraToStart)
        {
            CameraDisplay cameraDisplay = null;

            if (filters.VideoInputDevices.Count > 0)
            {
                if (isRunning(cameraToStart.Name))
                {
                    currentCameraWindow.Close();
                }

                int cameraWindowCount = getRunningCameraCount();

                for (int x = 0; x < filters.VideoInputDevices.Count; x++)
                {
                    if (filters.VideoInputDevices[x].MonikerString == cameraToStart.VideoDevice.MonikerString)//this is the camera to record
                    {
                        cameraDisplay = new CameraDisplay(filters.VideoInputDevices[x], filters.AudioInputDevices[0]);

                        cameraDisplay.FrameSize = getFrameSize();

                        cameraDisplay.Show();

                        cameraDisplay.Left = cameraWindowCount * 450;
                        cameraDisplay.Top  = 0;

                        cameraDisplay.Text = cameraToStart.Name;

                        currentCameraWindow = cameraDisplay;

                        lblCameraCapabilities.Text = cameraDisplay.GetCameraCapabilities;

                        break;
                    }
                }
            }
            else
            {
                MessageBox.Show("No Video input devices found");
            }
        }
Beispiel #4
0
        /// <summary>
        /// Reads xml file to get info on available cameras
        /// </summary>
        private void getCameraInfo()
        {
            //match list of filters to xml to find available cameras and their properties
            try
            {
                XmlDocument xmlCameras = new XmlDocument();
                if (System.IO.File.Exists(camerasConfigPath))
                {
                    xmlCameras.Load(camerasConfigPath);
                }
                else
                {
                    getNewCameras();
                }

                XmlNode nameNode;
                XmlNode monikerStringNode;
                XmlNode recordPathNode;
                string  name       = "";
                string  moniker    = "";
                string  recordPath = "";

                cameras.Clear();

                foreach (XmlNode camera in xmlCameras["Cameras"])
                {
                    name       = "";
                    moniker    = "";
                    recordPath = "";

                    nameNode          = camera.SelectSingleNode("name");
                    monikerStringNode = camera.SelectSingleNode("monikerString");
                    recordPathNode    = camera.SelectSingleNode("recordPath");

                    if (monikerStringNode != null && monikerStringNode.InnerText.ToString().Trim().Length > 0)
                    {
                        moniker = monikerStringNode.InnerText.ToString().Trim();

                        if (nameNode != null && nameNode.InnerText.ToString().Trim().Length > 0)
                        {
                            name = nameNode.InnerText.ToString().Trim();
                        }

                        if (recordPathNode != null && recordPathNode.InnerText.ToString().Trim().Length > 0)
                        {
                            recordPath = nameNode.InnerText.ToString().Trim();
                        }

                        //iterate filters and see if this camera is on
                        for (int x = 0; x < filters.VideoInputDevices.Count; x++)
                        {
                            if (filters.VideoInputDevices[x].MonikerString == moniker) // || filters.AudioInputDevices[x].MonikerString == moniker)//this is our camera
                            {
                                SecurityCamera securityCamera = new SecurityCamera();
                                securityCamera.Name       = name;
                                securityCamera.RecordPath = recordPath;

                                if (x < filters.VideoInputDevices.Count)
                                {
                                    securityCamera.VideoDevice = filters.VideoInputDevices[x];
                                }

                                if (x < filters.AudioInputDevices.Count)
                                {
                                    securityCamera.AudioDevice = filters.AudioInputDevices[x];
                                }

                                cameras.Add(securityCamera);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Tools.WriteToFile(Tools.errorFile, e.ToString());
            }
        }