Пример #1
0
 public override void Confirm(ConfirmConfig config)
 {
     var dialog = new MessageDialog(config.Message, config.Title);
     dialog.Commands.Add(new UICommand(config.OkText, x => config.OnConfirm(true)));
     dialog.Commands.Add(new UICommand(config.CancelText, x => config.OnConfirm(false)));
     dialog.ShowAsync();
 }
Пример #2
0
        public override void Confirm(ConfirmConfig config)
        {
            var dialog = new MessageDialog(config.Message, config.Title);

            dialog.Commands.Add(new UICommand(config.OkText, x => config.OnConfirm(true)));
            dialog.Commands.Add(new UICommand(config.CancelText, x => config.OnConfirm(false)));
            dialog.ShowAsync();
        }
Пример #3
0
        public override void Confirm(ConfirmConfig config) {
            var dialog = new MessageDialog(config.Message, config.Title);
            dialog.Commands.Add(new UICommand(config.OkText, x => config.OnConfirm(true)));
            dialog.DefaultCommandIndex = 0;

            dialog.Commands.Add(new UICommand(config.CancelText, x => config.OnConfirm(false)));
            dialog.CancelCommandIndex = 1;
            this.Dispatch(() => dialog.ShowAsync());
        }
Пример #4
0
        public override void Confirm(ConfirmConfig config)
        {
            var dialog = new MessageDialog(config.Message, config.Title);

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

            dialog.Commands.Add(new UICommand(config.CancelText, x => config.OnConfirm(false)));
            dialog.CancelCommandIndex = 1;
            this.Dispatch(() => dialog.ShowAsync());
        }
Пример #5
0
 public override void Confirm(ConfirmConfig config)
 {
     Utils.RequestMainThread(() =>
                             new AlertDialog
                             .Builder(this.getTopActivity())
                             .SetMessage(config.Message)
                             .SetTitle(config.Title)
                             .SetPositiveButton(config.OkText, (o, e) => config.OnConfirm(true))
                             .SetNegativeButton(config.CancelText, (o, e) => config.OnConfirm(false))
                             .Show()
                             );
 }
Пример #6
0
        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.OnConfirm(ok);
            };
            return(new DisposableAction(dlg.Dispose));
        }
Пример #7
0
 public override void Confirm(ConfirmConfig config) {
     if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) {
         var dlg = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert);
         dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnConfirm(true)));
         dlg.AddAction(UIAlertAction.Create(config.CancelText, UIAlertActionStyle.Default, x => config.OnConfirm(false)));
         this.Present(dlg);
     }
     else {
         var dlg = new UIAlertView(config.Title ?? String.Empty, config.Message, null, config.CancelText, config.OkText);
         dlg.Clicked += (s, e) => {
             var ok = ((int)dlg.CancelButtonIndex != (int)e.ButtonIndex);
             config.OnConfirm(ok);
         };
         this.Present(dlg);
     }
 }
Пример #8
0
        public override IDisposable Confirm(ConfirmConfig config)
        {
            var dialog = new MessageDialog(config.Message, config.Title);

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

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

            IAsyncOperation <IUICommand> dialogTask = null;

            return(this.DispatchAndDispose(
                       () => dialogTask = dialog.ShowAsync(),
                       () => dialogTask?.Cancel()
                       ));
        }
Пример #9
0
 public override void Confirm(ConfirmConfig config) {
     var confirm = new CustomMessageBox {
         Caption = config.Title,
         Message = config.Message,
         LeftButtonContent = config.OkText,
         RightButtonContent = config.CancelText
     };
     confirm.Dismissed += (sender, args) => config.OnConfirm(args.Result == CustomMessageBoxResult.LeftButton);
     this.Dispatch(confirm.Show);
 }
Пример #10
0
        public override async void Confirm(ConfirmConfig config)
        {
            var input = new InputDialog {
                AcceptButton = config.OkText,
                CancelButton = config.CancelText
            };
            var choice = await input.ShowAsync(config.Title, config.Message);

            config.OnConfirm(config.OkText == choice);
        }
Пример #11
0
        public override void Confirm(ConfirmConfig config)
        {
            var confirm = new CustomMessageBox {
                Caption            = config.Title,
                Message            = config.Message,
                LeftButtonContent  = config.OkText,
                RightButtonContent = config.CancelText
            };

            confirm.Dismissed += (sender, args) => config.OnConfirm(args.Result == CustomMessageBoxResult.LeftButton);
            this.Dispatch(confirm.Show);
        }
        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.OnConfirm(args.Result == CustomMessageBoxResult.LeftButton);
            return(this.DispatchWithDispose(confirm.Show, confirm.Dismiss));
        }
 public override void Confirm(ConfirmConfig config)
 {
     if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
     {
         var dlg = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert);
         dlg.AddAction(UIAlertAction.Create(config.CancelText, UIAlertActionStyle.Cancel, x => config.OnConfirm(false)));
         dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnConfirm(true)));
         this.Present(dlg);
     }
     else
     {
         var dlg = new UIAlertView(config.Title ?? String.Empty, config.Message, null, config.CancelText, config.OkText);
         dlg.Clicked += (s, e) => {
             var ok = ((int)dlg.CancelButtonIndex != (int)e.ButtonIndex);
             config.OnConfirm(ok);
         };
         this.Present(dlg);
     }
 }
        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.OnConfirm(false)));
            dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnConfirm(true)));
            return(this.Present(dlg));
        }
Пример #15
0
 public override void Confirm(ConfirmConfig config)
 {
     Utils.RequestMainThread(() =>
         new AlertDialog
             .Builder(this.getTopActivity())
             .SetCancelable(false)
             .SetMessage(config.Message)
             .SetTitle(config.Title)
             .SetPositiveButton(config.OkText, (o, e) => config.OnConfirm(true))
             .SetNegativeButton(config.CancelText, (o, e) => config.OnConfirm(false))
             .Show()
     );
 }