Esempio n. 1
0
        private void buttonRecorder_Click(object sender, EventArgs e)
        {
            switch (vsPropertyType)
            {
            case VsDeviceType.CAMERA:
            {
                VsCamera vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);
                if (vsCamera == null)
                {
                    return;
                }
                vsCamera.Recording = !vsCamera.Recording;
                ActivatePropertyControl(VsDeviceType.CAMERA, vsTypeName);
            }
            break;

            case VsDeviceType.CHANNEL:
            {
                VsChannel vsChannel = vsCoreMonitor.GetChannelByName(vsTypeName);
                if (vsChannel == null)
                {
                    return;
                }
                vsChannel.Recording = !vsChannel.Recording;
                ActivatePropertyControl(VsDeviceType.CHANNEL, vsTypeName);
            }
            break;
            }
        }
Esempio n. 2
0
        private void buttonConnecter_Click(object sender, EventArgs e)
        {
            switch (vsPropertyType)
            {
            case VsDeviceType.CAMERA:
            {
                this.vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);

                if (vsCamera == null)
                {
                    return;
                }
                if (vsCamera.Running)
                {
                    vsCoreMonitor.DisconnectCamera(vsTypeName);
                }
                else
                {
                    vsCoreMonitor.ConnectCamera(vsTypeName, false);
                }
            }
            break;

            case VsDeviceType.CHANNEL:
            {
                this.vsChannel = vsCoreMonitor.GetChannelByName(vsTypeName);
                if (vsChannel == null)
                {
                    return;
                }
                if (vsChannel.Running)
                {
                    vsCoreMonitor.DisconnectChannel(vsTypeName);
                }
                else
                {
                    vsCoreMonitor.ConnectChannel(vsTypeName, false);
                }
            }
            break;

            case VsDeviceType.PAGE:
            {
                this.vsPage = vsCoreMonitor.GetPageByName(vsTypeName);
                if (vsPage == null)
                {
                    return;
                }
                if (vsPage.Running)
                {
                    vsCoreMonitor.DisconnectPage(vsTypeName);
                }
                else
                {
                    vsCoreMonitor.ConnectPage(vsTypeName, false);
                }
            }
            break;
            }
        }
Esempio n. 3
0
        private void cameraDisconnectMenu_Click(object sender, EventArgs e)
        {
            TreeNode node = vsCameraTree.SelectedNode;

            if (node == null || node.Parent == null)
            {
                return;
            }
            String selectedNode = node.Text;

            VsCamera vsCamera = vsCoreMonitor.GetCameraByName(selectedNode);

            // test if camera is connected
            if (!vsCoreMonitor.ConnectingCamera(selectedNode))
            {
                return;
            }

            // try to connect
            if (vsCoreMonitor.DisconnectCamera(selectedNode))
            {
                // TODO...
            }

            // TODO...
        }
Esempio n. 4
0
        public void ActivatePropertyControl(VsDeviceType propType, String propName)
        {
            vsPropertyType = propType;
            vsTypeName     = propName;

            this.Enabled = true;

            switch (vsPropertyType)
            {
            case VsDeviceType.CAMERA:
                CameraProperty();
                this.vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);
                break;

            case VsDeviceType.CHANNEL:
                ChannelProperty();
                this.vsChannel = vsCoreMonitor.GetChannelByName(vsTypeName);
                break;

            case VsDeviceType.PAGE:
                PageProperty();
                this.vsPage = vsCoreMonitor.GetPageByName(vsTypeName);
                break;
            }
        }
Esempio n. 5
0
        private void buttonZoomOut_Click(object sender, EventArgs e)
        {
            VsCamera vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);

            if (vsCamera == null)
            {
                return;
            }
            vsCamera.ZoomOut();
        }
Esempio n. 6
0
        private void buttonDataAlert_Click(object sender, EventArgs e)
        {
            VsCamera vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);

            if (vsCamera == null)
            {
                return;
            }
            vsCamera.DataAlerting = !vsCamera.DataAlerting;
            ActivatePropertyControl(VsDeviceType.CAMERA, vsTypeName);
        }
Esempio n. 7
0
 // On page changing
 protected override void OnPageChanging(int page)
 {
     if (page == 1)
     {
         // switching to vsCamera settings
         vsCamera = vsCameraDescription.Camera;
         vsCameraSetting.Camera   = vsCamera;
         vsAnalyzerSetting.Camera = vsCamera;
         vsEncoderSetting.Camera  = vsCamera;
     }
     base.OnPageChanging(page);
 }
Esempio n. 8
0
        private void buttonStreamer_Click(object sender, EventArgs e)
        {
            switch (vsPropertyType)
            {
            case VsDeviceType.CAMERA:
            {
                VsCamera vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);
                if (vsCamera == null)
                {
                    return;
                }
                vsCamera.Streaming = !vsCamera.Streaming;
                ActivatePropertyControl(VsDeviceType.CAMERA, vsTypeName);
            }
            break;

            case VsDeviceType.CHANNEL:
            {
                VsChannel vsChannel = vsCoreMonitor.GetChannelByName(vsTypeName);
                if (vsChannel == null)
                {
                    return;
                }

                if (vsChannel.Streaming)
                {
                    vsCoreMonitor.StopStreamChannel(vsTypeName);
                }
                else
                {
                    vsCoreMonitor.StartStreamChannel(vsTypeName, textIp.Text, int.Parse(textPort.Text));
                }
                ActivatePropertyControl(VsDeviceType.CHANNEL, vsTypeName);
            }
            break;

            case VsDeviceType.PAGE:
            {
                VsPage vsPage = vsCoreMonitor.GetPageByName(vsTypeName);
                if (vsPage == null)
                {
                    return;
                }
                vsPage.Streaming = !vsPage.Streaming;
                ActivatePropertyControl(VsDeviceType.PAGE, vsTypeName);
            }
            break;
            }
        }
Esempio n. 9
0
        // Construction
        public VsAnalyzerDialog(VsCoreServer vsCore, VsCamera vsCam)
        {
            this.AddPage(vsAnalyzerSetting);
            vsAnalyzerSetting.CoreMonitor = vsCoreMonitor;
            vsAnalyzerSetting.Camera      = vsCam;

            // set current core
            vsCamera      = vsCam;
            vsCoreMonitor = vsCore;

            this.Text = "Analyzer";
            this.buttonApply.Visible = true;
            this.backButton.Visible  = false;
            this.nextButton.Visible  = false;
            this.imagePanel.Visible  = false;
        }
Esempio n. 10
0
 // Apply the page
 public bool Apply()
 {
     for (int j = 0; j < vsChannelGrid.Rows; j++)
     {
         for (int i = 0; i < vsChannelGrid.Cols; i++)
         {
             String cameraName = vsChannelGrid.GetLabel(j, i);
             if (cameraName != null)
             {
                 VsCamera vsCamera = vsCoreMonitor.GetCameraByName(cameraName);
                 vsChannel.SetCamera(vsCamera.CameraID, vsCamera);
             }
         }
     }
     return(true);
 }
Esempio n. 11
0
    public List <VsCamera> getCamAll()
    {
        string configPath = Path.Combine(Environment.GetEnvironmentVariable("VsPath", EnvironmentVariableTarget.Machine), "cameras.config");

        CamConfigData[] camDatas = CamConfigData.LoadSettings(configPath);
        List <VsCamera> camList  = new List <VsCamera>();

        foreach (CamConfigData camData in camDatas)
        {
            VsCamera c = new VsCamera();
            c.cameraID = camData.name;
            c.location = camData.name;
            camList.Add(c);
        }

        return(camList);
        // return DBconn.getCamAll();
    }
Esempio n. 12
0
        private void buttonEventAlert_Click(object sender, EventArgs e)
        {
            VsCamera vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);

            if (vsCamera == null)
            {
                return;
            }
            vsCamera.EventAlerting = !vsCamera.EventAlerting;
            ActivatePropertyControl(VsDeviceType.CAMERA, vsTypeName);

            if (vsCamera.EventAlerting)
            {
                this.vsUpdateEvent(this, new VsMonitorEventArgs(
                                       new VsAlarmParas(VsAppControlType.APP_PROPERTY, VsAppControlType.APP_ALARM, VsDeviceType.CAMERA, vsTypeName, VsAlarmType.ALARM_ATTACH)));
            }
            else
            {
                this.vsUpdateEvent(this, new VsMonitorEventArgs(
                                       new VsAlarmParas(VsAppControlType.APP_PROPERTY, VsAppControlType.APP_ALARM, VsDeviceType.CAMERA, vsTypeName, VsAlarmType.ALARM_DETACH)));
            }
        }
Esempio n. 13
0
        private void CameraProperty()
        {
            this.label1.Text = vsTypeName;
            this.buttonRecorder.Show();
            this.buttonRecorderStatus.Show();
            // get camera
            VsCamera vsCamera = vsCoreMonitor.GetCameraByName(this.vsTypeName);

            if (vsCamera == null)
            {
                return;
            }

            // connecter button
            if (vsCamera.Running)
            {
                this.buttonConnectorStatus.BackColor = Color.Red;
                this.buttonStreamer.Enabled          = true;
                this.buttonRecorder.Enabled          = true;
            }
            else
            {
                this.buttonConnectorStatus.BackColor = Color.Green;
                this.buttonStreamer.Enabled          = false;
                this.buttonRecorder.Enabled          = false;
            }

            // recorder button
            if (vsCamera.Recording)
            {
                this.buttonRecorderStatus.BackColor = Color.Red;
            }
            else
            {
                this.buttonRecorderStatus.BackColor = Color.Green;
            }
        }
Esempio n. 14
0
        private void CloseAll()
        {
            foreach (TreeNode tn in vsLiveviewTool1.VsApplicationControl1.CamerasNode.Nodes)
            {
                VsCamera vsCamera = vsCoreMonitor.GetCameraByName(tn.Text);

                if (vsCamera == null)
                {
                    continue;
                }
                if (vsCamera.Running)
                {
                    vsCoreMonitor.DisconnectCamera(tn.Text);
                }
                // else vsCoreMonitor.ConnectCamera(vsTypeName, false);
            }
            foreach (TreeNode tn in vsLiveviewTool1.VsApplicationControl1.ChannelsNode.Nodes)
            {
                VsChannel vsChannel = vsCoreMonitor.GetChannelByName(tn.Text);
                if (vsChannel == null)
                {
                    continue;
                }
                if (vsChannel.Running)
                {
                    vsCoreMonitor.DisconnectChannel(tn.Text);
                }
                //else vsCoreMonitor.ConnectChannel(vsTypeName, false);
            }

            for (int i = 24; i >= 0; i--)
            {
                VsSingleViewer viewer = vsLiveviewTool1.VsMultiViewer1.VsSingleViewers[i];
                viewer.CloseCameraView();
            }
        }
Esempio n. 15
0
    public List<VsCamera> getCamAll()
    {
        string configPath = Path.Combine(Environment.GetEnvironmentVariable("VsPath", EnvironmentVariableTarget.Machine), "cameras.config");

        CamConfigData[] camDatas = CamConfigData.LoadSettings(configPath);
        List<VsCamera> camList = new List<VsCamera>();

        foreach (CamConfigData camData in camDatas)
        {
            VsCamera c = new VsCamera();
            c.cameraID = camData.name;
            c.location = camData.name;
            camList.Add(c);
        }

        return camList;
        // return DBconn.getCamAll();
    }
Esempio n. 16
0
        public void connectDevice(string send)
        {
            if (vsStatus == VsViewStatusType.VIEW_CONNECTING || vsStatus == VsViewStatusType.VIEW_CONNECTED)
            {
                return;
            }

            string[] cmd = send.Split('\\');

            vsDeviceName = cmd[1];
            // check if not root node
            if (cmd.Length == 2 && cmd[0] == "Analyzers")
            {
                // set flag
                vsDeviceType = VsDeviceType.CAMERA;
                vsStatus     = VsViewStatusType.VIEW_CONNECTING;

                // update event
                this.vsUpdateEvent(this, new VsMonitorEventArgs(
                                       new VsParameter(VsAppControlType.APP_SIGLEVIEW, VsAppControlType.APP_SIGLEVIEW, vsDeviceType, vsDeviceName)));

                labelStatus.Text = "Connecting...";
                // the current camera is connected
                if (!vsCoreMonitor.ConnectingCamera(vsDeviceName))
                {
                    // not connected
                    // try to connect
                    if (!vsCoreMonitor.ConnectCamera(vsDeviceName, false))
                    {
                        return;
                    }

                    // cache current camera
                    vsCamera = vsCoreMonitor.GetCameraByName(vsDeviceName);
                }

                // the camera is connected
                // attach to current view
                vsCoreMonitor.AttachCameraView(vsDeviceName, this);
                vsAttachType = VsAttachType.ATTACH_RECEIVER;

                // enable toolbox
                buttonStop.Enabled     = true;
                buttonAttach.Enabled   = true;
                buttonAnalyzer.Enabled = true;
            }
            else if (cmd.Length == 2 && cmd[0] == "Layouts")
            {
                // set flag
                vsDeviceType = VsDeviceType.CHANNEL;
                vsStatus     = VsViewStatusType.VIEW_CONNECTING;

                // update event
                this.vsUpdateEvent(this, new VsMonitorEventArgs(
                                       new VsParameter(VsAppControlType.APP_SIGLEVIEW, VsAppControlType.APP_SIGLEVIEW, vsDeviceType, vsDeviceName)));

                // the current channel is connected
                if (!vsCoreMonitor.ConnectingChannel(vsDeviceName))
                {
                    // not connected
                    // try to connect
                    if (!vsCoreMonitor.ConnectChannel(vsDeviceName, false))
                    {
                        return;
                    }

                    // cache current camera
                    vsChannel = vsCoreMonitor.GetChannelByName(vsDeviceName);
                }

                // the camera is connected
                // attach to current view
                vsCoreMonitor.AttachChannelView(vsDeviceName, this);

                // enable toolbox
                buttonStop.Enabled     = true;
                buttonAttach.Enabled   = true;
                buttonAnalyzer.Enabled = true;
            }
        }
Esempio n. 17
0
        private void CameraProperty()
        {
            // text define
            //this.tabPageCamera.Text = "Camera";
            //this.label1.Text = vsTypeName;

            // enable/disable control

            /*
             * if (!this.tabControl1.Contains(tabPageAnalyzer))
             *  this.tabControl1.Controls.Add(tabPageAnalyzer);
             * if (!this.tabControl1.Contains(tabPageRecorder))
             *  this.tabControl1.Controls.Add(tabPageRecorder);
             */
            //if (this.tabControl1.Contains(tabPageStreamer))
            //    this.tabControl1.Controls.Remove(tabPageStreamer);

            //controlBox.Show();

            // enable/disable button
            this.buttonAnalyzer.Show();
            this.buttonRecorder.Show();
            this.buttonDataAlert.Show();
            this.buttonEventAlert.Show();
            this.buttonAnalyzerStatus.Show();
            this.buttonRecorderStatus.Show();
            this.buttonDataAlertStatus.Show();
            this.buttonEventAlertStatus.Show();

            // get camera
            VsCamera vsCamera = vsCoreMonitor.GetCameraByName(this.vsTypeName);

            if (vsCamera == null)
            {
                return;
            }

            // connecter button
            if (vsCamera.Running)
            {
                this.buttonConnectorStatus.BackColor = Color.Red;
                this.buttonStreamer.Enabled          = true;
                this.buttonAnalyzer.Enabled          = true;
                this.buttonRecorder.Enabled          = true;
                this.buttonDataAlert.Enabled         = true;
                this.buttonEventAlert.Enabled        = true;
            }
            else
            {
                this.buttonConnectorStatus.BackColor = Color.Green;
                this.buttonStreamer.Enabled          = false;
                this.buttonAnalyzer.Enabled          = false;
                this.buttonRecorder.Enabled          = false;
                this.buttonDataAlert.Enabled         = false;
                this.buttonEventAlert.Enabled        = false;
            }

            // streamer button
            if (vsCamera.Streaming)
            {
                this.buttonStreamerStatus.BackColor = Color.Red;
            }
            else
            {
                this.buttonStreamerStatus.BackColor = Color.Green;
            }

            // analyzer button
            if (vsCamera.Analysing)
            {
                this.buttonAnalyzerStatus.BackColor = Color.Red;
            }
            else
            {
                this.buttonAnalyzerStatus.BackColor = Color.Green;
            }

            // recorder button
            if (vsCamera.Recording)
            {
                this.buttonRecorderStatus.BackColor = Color.Red;
            }
            else
            {
                this.buttonRecorderStatus.BackColor = Color.Green;
            }

            // data alert button
            if (vsCamera.DataAlerting)
            {
                this.buttonDataAlertStatus.BackColor = Color.Red;
            }
            else
            {
                this.buttonDataAlertStatus.BackColor = Color.Green;
            }

            // event alert button
            if (vsCamera.EventAlerting)
            {
                this.buttonEventAlertStatus.BackColor = Color.Red;
            }
            else
            {
                this.buttonEventAlertStatus.BackColor = Color.Green;
            }
        }