void Close(bool okPressed) { if (okPressed) { if (ProfileTypes.Count(p => p.IsSelected) != 1) { _uiService.ShowErrorDialog("Please select exactly one option.", ComponentContainer.MessageBoxTitle); return; } SelectedProfile = ProfileTypes.Single(p => p.IsSelected).ProfileType; } CloseRequested?.Invoke(this, new CloseEventArgs(okPressed)); }
public bool Validate() { IOptionsViewModel firstViewModelWithError; string errorMessage; if (!Validate(out errorMessage, out firstViewModelWithError)) { _uiService.ShowErrorDialog(errorMessage, Strings.Get($"Some options contain invalid values")); if (firstViewModelWithError != null) { firstViewModelWithError.IsSelected = true; } return(false); } return(true); }
private void Close(bool shouldSaveNewOptions) { if (shouldSaveNewOptions) { IOptionsViewModel firstViewModelWithError; string errorMessage; if (!Validate(out errorMessage, out firstViewModelWithError)) { _uiService.ShowErrorDialog(errorMessage, "Some Options contain invalid Values"); if (firstViewModelWithError != null) { firstViewModelWithError.IsSelected = true; } return; } } CloseRequested?.Invoke(this, new CloseEventArgs(shouldSaveNewOptions)); }
void Close(bool okPressed) { if (okPressed) { if (ProfileTypes.Count(p => p.IsSelected) != 1) { _uiService.ShowErrorDialog(Strings.Get($"Please select exactly one option."), ComponentContainer.MessageBoxTitle); return; } if (StringComparer.InvariantCultureIgnoreCase.Equals(ProfileTypes.Single(p => p.IsSelected).ProfileType.Name, "Open-Xchange")) { _uiService.ShowOXInfoDialog(); return; } SelectedProfile = ProfileTypes.Single(p => p.IsSelected).ProfileType; } CloseRequested?.Invoke(this, new CloseEventArgs(okPressed)); }