示例#1
0
        //invoked method
        void vsApplicationControl_Update(object sender, VsMonitorEventArgs e)
        {
            foreach (TreeNode tn in camerasNode.Nodes)
            {
                if (vsCoreMonitor.GetCameraByName(tn.Text).Running)
                {
                    tn.ImageIndex = 7; tn.SelectedImageIndex = 7;
                }
                else
                {
                    tn.ImageIndex = 4; tn.SelectedImageIndex = 4;
                }
            }

            foreach (TreeNode tn in channelsNode.Nodes)
            {
                if (vsCoreMonitor.GetChannelByName(tn.Text).Running)
                {
                    tn.ImageIndex = 7; tn.SelectedImageIndex = 7;
                }
                else
                {
                    tn.ImageIndex = 5; tn.SelectedImageIndex = 5;
                }
            }

            /*
             * foreach (TreeNode tn in pagesNode.Nodes)
             * {
             *  if (vsCoreMonitor.GetPageByName(tn.Text).Running)
             *  { tn.ImageIndex = 7; tn.SelectedImageIndex = 7; }
             *  else { tn.ImageIndex = 6; tn.SelectedImageIndex = 6; }
             * }
             */
        }
示例#2
0
        private void ChannelProperty()
        {
            // text define
            //this.tabPageCamera.Text = "Layout";
            //this.label1.Text = "Properties : " + "\"" + vsTypeName + "\"";

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

            //controlBox.Hide();

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

            // get channel
            VsChannel vsChannel = vsCoreMonitor.GetChannelByName(this.vsTypeName);

            if (vsChannel == null)
            {
                return;
            }

            // connecter button
            if (vsChannel.Running)
            {
                this.buttonConnecter.Text = "Stop Channel";
            }
            else
            {
                this.buttonConnecter.Text = "Start Channel";
            }

            // streamer button
            if (vsChannel.Streaming)
            {
                this.buttonStreamer.Text = "Stop Streamer";
            }
            else
            {
                this.buttonStreamer.Text = "Start Streamer";
            }
        }
        // Apply the page
        public bool Apply()
        {
            string name = channelName.Text.Replace('\\', ' ');

            // check vsChannel
            if (vsCoreMonitor.GetChannelByName(name) != null)
            {
                Color tmp = this.channelName.BackColor;

                // highlight name edit box
                this.channelName.BackColor = Color.LightCoral;
                // error message
                MessageBox.Show(this, "A channel with such name is already exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                // restore & focus name edit box
                this.channelName.BackColor = tmp;
                this.channelName.Focus();

                return(false);
            }

            // update vsChannel name and description
            vsChannel.ChannelName = name;
            vsChannel.Description = channelDescription.Text;

            try
            {
                vsChannel.Cols       = short.Parse(colsCombo.SelectedItem.ToString());
                vsChannel.Rows       = short.Parse(rowsCombo.SelectedItem.ToString());
                vsChannel.CellWidth  = short.Parse(cellWidthBox.Text);
                vsChannel.CellHeight = short.Parse(cellHeightBox.Text);

                // update vsCamera name and description
                vsChannel.Analyser = vsCoreMonitor.GetAnalyzerByName(SelectedAnalyserName);
                vsChannel.Encoder  = vsCoreMonitor.GetEncoderByName(SelectedEncoderName);
            }
            catch (Exception) { }

            return(true);
        }
示例#4
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();
            }
        }
示例#5
0
        private void ChannelProperty()
        {
            // text define
            this.label1.Text = "Properties : " + "\"" + vsTypeName + "\"";

            // enable/disable button
            this.buttonRecorder.Show();
            this.buttonRecorderStatus.Show();

            // get channel
            VsChannel vsChannel = vsCoreMonitor.GetChannelByName(this.vsTypeName);

            if (vsChannel == null)
            {
                return;
            }

            // connecter button
            if (vsChannel.Running)
            {
                this.buttonConnecter.Text = "Stop Channel";
            }
            else
            {
                this.buttonConnecter.Text = "Start Channel";
            }

            // streamer button
            if (vsChannel.Streaming)
            {
                this.buttonStreamer.Text = "Stop Streamer";
            }
            else
            {
                this.buttonStreamer.Text = "Start Streamer";
            }
        }
示例#6
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;
            }
        }