public Task ShowAlertAsync(string title, string message, MessageDialogServiceOptions options = null) => Application.Current.Dispatcher.Invoke(async() => { await this.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative, new MetroDialogSettings { AffirmativeButtonText = "Ok" }).ConfigureAwait(false); });
public async Task <bool> ShowYesNoDialogAsync(string title, string message, MessageDialogServiceOptions options = null) { var settings = new MetroDialogSettings(); if (options?.ShowCancel == true) { settings.FirstAuxiliaryButtonText = "Cancel"; } bool result = false; await Application.Current.Dispatcher.Invoke(async() => { var msgBoxResult = await this.ShowMessageAsync(title, message, MessageDialogStyle.AffirmativeAndNegative, null).ConfigureAwait(false); if (msgBoxResult == MessageDialogResult.Affirmative) { result = true; } else if (msgBoxResult == MessageDialogResult.FirstAuxiliary && options.ShowCancel && options.CancelCallback != null) { options.CancelCallback(); } }).ConfigureAwait(false); return(result); }
public void MessageDialogServiceOptions_Ctor_DialogStyle_Should_Be_Info_By_Default() { var o = new MessageDialogServiceOptions(); o.DialogStyle.Should().Be(AlertType.Info); }