Esempio n. 1
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. 2
0
        private void cameraConnect_Click(object sender, EventArgs e)
        {
            TreeNode node = vsCameraTree.SelectedNode;

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

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

            // try to connect
            if (vsCoreMonitor.ConnectCamera(selectedNode, false))
            {
                // TODO...
            }

            // TODO...
        }
Esempio n. 3
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;
            }
        }