private void OnOkButtonClick(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(_titleTextBox.Text)) { _controller.ShowError("Title is empty!"); return; } if (string.IsNullOrWhiteSpace(_uriTextBox.Text)) { _controller.ShowError("Uri is empty!"); return; } if (string.IsNullOrWhiteSpace(_passwordTextBox.Text)) { _controller.ShowError("User is empty!"); return; } if (string.IsNullOrWhiteSpace(_passwordTextBox.Text)) { _controller.ShowError("Password is empty!"); return; } DialogResult = DialogResult.OK; Close(); }
private void ConnectToCamera(CamViewerController controller, params object[] args) { var camRef = (string)args[0]; var targetCam = controller.Model.Settings.Connections.FirstOrDefault(cnn => cnn.Reference == camRef); if (targetCam == null) { controller.ShowError("Camera with reference {0} is missing.", camRef); } else { controller.ConnectToCamera(targetCam); } }