// 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() { 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); }