예제 #1
0
        public override async void Alert(AlertConfig config)
        {
            var input = new InputDialog();
            await input.ShowAsync(config.Title, config.Message, config.OkText);

            if (config.OnOk != null)
            {
                config.OnOk();
            }
        }
예제 #2
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);
        }
        public override IDisposable Prompt(PromptConfig config)
        {
            var dlg = new InputDialog {
                Title      = config.Title,
                Text       = config.Text,
                OkText     = config.OkText,
                CancelText = config.CancelText,
                IsPassword = config.InputType == InputType.Password
            };

            dlg.ShowDialog();
            config.OnAction(new PromptResult(dlg.WasOk, dlg.Text));

            return(new DisposableAction(dlg.Dispose));
        }
예제 #4
0
        public override async void Prompt(PromptConfig config)
        {
            var input = new InputDialog {
                AcceptButton = config.OkText,
                CancelButton = config.CancelText,
                InputText    = config.Placeholder
            };
            var result = await input.ShowAsync(config.Title, config.Message);

//            input
//                .ShowAsync(title, message)
//                .ContinueWith(x => {
//                    // TODO: how to get button click for this scenario?
//                });
        }
예제 #5
0
        public override async void ActionSheet(ActionSheetConfig config)
        {
            var input = new InputDialog {
                ButtonsPanelOrientation = Orientation.Vertical
            };

            var buttons = config
                          .Options
                          .Select(x => x.Text)
                          .ToArray();

            var choice = await input.ShowAsync(config.Title, null, buttons);

            var opt = config.Options.SingleOrDefault(x => x.Text == choice);

            if (opt != null && opt.Action != null)
            {
                opt.Action();
            }
        }