Esempio n. 1
0
 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);
 });
Esempio n. 2
0
        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);
        }