//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; } * } */ }
// Apply the page public bool Apply() { String name = cameraName.Text.Replace('\\', ' '); // check vsCamera if (vsCoreMonitor.GetCameraByName(name) != null) { Color tmp = this.cameraName.BackColor; // highligh name edit box this.cameraName.BackColor = Color.LightCoral; // error message MessageBox.Show(this, "A vsCamera with such name is already exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); // restore & focus name edit box this.cameraName.BackColor = tmp; this.cameraName.Focus(); return(false); } // update vsCamera name and description vsCamera.CameraName = name; vsCamera.CameraDescription = cameraDescription.Text; vsCamera.Provider = vsCoreMonitor.GetProviderByName(SelectedProviderName); vsCamera.Analyser = vsCoreMonitor.GetAnalyzerByName(SelectedAnalyserName); vsCamera.Encoder = vsCoreMonitor.GetEncoderByName(SelectedEncoderName); return(true); }
// 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); }
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(); } }
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; } }
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; } }
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; } }