Example #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;
            }
        }