public override IDisposable Confirm(ConfirmConfig config)
 {
     var dlg = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert);
     dlg.AddAction(UIAlertAction.Create(config.CancelText, UIAlertActionStyle.Cancel, x => config.OnAction(false)));
     dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnAction(true)));
     return this.Present(dlg);
 }
        public override IDisposable Confirm(ConfirmConfig config)
        {
            var dlg = new TaskDialog
            {
                WindowTitle = config.Title,
                Content     = config.Message,
                Buttons     =
                {
                    new TaskDialogButton(config.CancelText)
                    {
                        ButtonType = ButtonType.Cancel
                    },
                    new TaskDialogButton(config.OkText)
                    {
                        ButtonType = ButtonType.Ok
                    }
                }
            };

            dlg.ButtonClicked += (sender, args) =>
            {
                var ok = ((TaskDialogButton)args.Item).ButtonType == ButtonType.Ok;
                config.OnAction(ok);
            };
            return(new DisposableAction(dlg.Dispose));
        }
 public override IDisposable Confirm(ConfirmConfig config)
 {
     var dlg = new TaskDialog
     {
         WindowTitle = config.Title,
         Content = config.Message,
         Buttons =
         {
             new TaskDialogButton(config.CancelText)
             {
                 ButtonType = ButtonType.Cancel
             },
             new TaskDialogButton(config.OkText)
             {
                 ButtonType = ButtonType.Ok
             }
         }
     };
     dlg.ButtonClicked += (sender, args) =>
     {
         var ok = ((TaskDialogButton)args.Item).ButtonType == ButtonType.Ok;
         config.OnAction(ok);
     };
     return new DisposableAction(dlg.Dispose);
 }
        public override IDisposable Confirm(ConfirmConfig config)
        {
            var dialog = new MessageDialog(config.Message, config.Title ?? String.Empty);

            dialog.Commands.Add(new UICommand(config.OkText, x => config.OnAction(true)));
            dialog.DefaultCommandIndex = 0;

            dialog.Commands.Add(new UICommand(config.CancelText, x => config.OnAction(false)));
            dialog.CancelCommandIndex = 1;

            IAsyncOperation <IUICommand> dialogTask = null;

            return(this.DispatchAndDispose(
                       () => dialogTask = dialog.ShowAsync(),
                       () => dialogTask?.Cancel()
                       ));
        }
Beispiel #5
0
 public override IDisposable Confirm(ConfirmConfig config)
 {
     Dispatch(() =>
     {
         FormsContentDialog dialog = new FormsContentDialog()
         {
             Title   = config.Title,
             Content = config.Message,
             IsPrimaryButtonEnabled   = true,
             PrimaryButtonText        = config.OkText,
             IsSecondaryButtonEnabled = true,
             SecondaryButtonText      = config.CancelText
         };
         dialog.PrimaryButtonClick   += (s, e) => { HideContentDialog(); config.OnAction(true); e.Cancel = true; };
         dialog.SecondaryButtonClick += (s, e) => { HideContentDialog(); config.OnAction(false); e.Cancel = true; };
         ShowContentDialog(dialog);
     });
     return(new DisposableAction(HideContentDialog));
 }
Beispiel #6
0
        public override IDisposable Confirm(ConfirmConfig config)
        {
            var confirm = new CustomMessageBox
            {
                Caption            = config.Title,
                Message            = config.Message,
                LeftButtonContent  = config.OkText,
                RightButtonContent = config.CancelText
            };

            confirm.Dismissed += (sender, args) => config.OnAction(args.Result == CustomMessageBoxResult.LeftButton);
            return(this.DispatchWithDispose(confirm.Show, confirm.Dismiss));
        }
Beispiel #7
0
        public override IDisposable Confirm(ConfirmConfig config)
        {
            var dlg = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert);

            dlg.AddAction(UIAlertAction.Create(config.CancelText, UIAlertActionStyle.Cancel, x => config.OnAction(false)));
            dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnAction(true)));
            return(this.Present(dlg));
        }
 public override IDisposable Confirm(ConfirmConfig config)
 {
     var confirm = new CustomMessageBox
     {
         Caption = config.Title,
         Message = config.Message,
         LeftButtonContent = config.OkText,
         RightButtonContent = config.CancelText
     };
     confirm.Dismissed += (sender, args) => config.OnAction(args.Result == CustomMessageBoxResult.LeftButton);
     return this.DispatchWithDispose(confirm.Show, confirm.Dismiss);
 }