/// <summary> /// Shows the provided message in a simple dialog with a warning icon and the specified buttons. /// </summary> /// <param name="message">The message to display.</param> /// <param name="detail">Additional information to display.</param> /// <param name="buttons">The buttons to display.</param> public static DialogResult ShowWarningPrompt(string message, string detail, Buttons buttons = Buttons.YesNo) { var vm = new TaskDialogViewModel(message, detail); vm.SetIcon(Icon.Warning); vm.SetButtons(buttons); if (!vm.ShowTaskDialog()) { var messageBoxViewModel = new MessageBoxViewModel(message + "\n\n" + detail); messageBoxViewModel.DialogTitle = "Warning"; switch (buttons) { case Buttons.YesNo: return(messageBoxViewModel.ShowYesNoDialog()); case Buttons.YesNoCancel: return(messageBoxViewModel.ShowYesNoCancelDialog()); case Buttons.RetryCancel: return(messageBoxViewModel.ShowRetryCancelDialog()); default: throw new NotImplementedException(buttons.ToString()); } } return(vm.DialogResult); }
/// <summary> /// Shows the provided message in a simple dialog. /// </summary> /// <param name="message">The message to display.</param> /// <param name="detail">Additional information to display.</param> public static void ShowMessage(string message, string detail) { var vm = new TaskDialogViewModel(message, detail); if (!vm.ShowTaskDialog()) { MessageBoxViewModel.ShowMessage(message + "\n\n" + detail); } }
/// <summary> /// Shows the provided message in a simple dialog with an error icon. /// </summary> /// <param name="message">The message to display.</param> /// <param name="detail">Additional information to display.</param> public static void ShowErrorMessage(string message, string detail) { var vm = new TaskDialogViewModel(message, detail); vm.SetIcon(Icon.Error); if (!vm.ShowTaskDialog()) { var messageBoxViewModel = new MessageBoxViewModel(message + "\n\n" + detail); messageBoxViewModel.DialogTitle = "Error"; messageBoxViewModel.ShowDialog(); } }
/// <summary> /// Executes the ok command. /// </summary> protected virtual void ExecuteOkCommand() { string errors = Validate(); if (String.IsNullOrEmpty(errors)) { Commit(); DialogResult = DialogResult.Ok; } else { var viewModel = new MessageBoxViewModel(errors, _dialogService); viewModel.DialogTitle = "Corrections required"; viewModel.ShowDialog(); } }
/// <summary> /// Shows the provided message in a simple dialog. /// </summary> /// <param name="message">The message to display.</param> public static void ShowMessage(string message) { var vm = new MessageBoxViewModel(message); vm.ShowDialog(); }