public override void ActionSheet(ActionSheetConfig config)
        {
            var dlg = new ActionSheetContentDialog();

            var vm = new ActionSheetViewModel {
                Title = config.Title,
                Cancel = new ActionSheetOptionViewModel(config.Cancel != null,config.Cancel?.Text, () => {
                    dlg.Hide();
                    config.Cancel?.Action?.Invoke();
                }),

                Destructive = new ActionSheetOptionViewModel(config.Destructive != null, config.Destructive?.Text, () => {
                    dlg.Hide();
                    config.Destructive?.Action?.Invoke();
                }),

                Options = config
                    .Options
                    .Select(x => new ActionSheetOptionViewModel(true, x.Text, () => {
                        dlg.Hide();
                        x.Action?.Invoke();
                    }))
                    .ToList()
            };

            dlg.DataContext = vm;
            dlg.ShowAsync();
        }
Esempio n. 2
0
        public override void ActionSheet(ActionSheetConfig config)
        {
            var dlg = new ActionSheetContentDialog();

            var vm = new ActionSheetViewModel {
                Title  = config.Title,
                Cancel = new ActionSheetOptionViewModel(config.Cancel != null, config.Cancel?.Text, () => {
                    dlg.Hide();
                    config.Cancel?.Action?.Invoke();
                }),

                Destructive = new ActionSheetOptionViewModel(config.Destructive != null, config.Destructive?.Text, () => {
                    dlg.Hide();
                    config.Destructive?.Action?.Invoke();
                }),

                Options = config
                          .Options
                          .Select(x => new ActionSheetOptionViewModel(true, x.Text, () => {
                    dlg.Hide();
                    x.Action?.Invoke();
                }, x.ItemIcon != null ? x.ItemIcon : config.ItemIcon))
                          .ToList()
            };

            dlg.DataContext = vm;
            this.Dispatch(() => dlg.ShowAsync());
        }
Esempio n. 3
0
        public override IDisposable ActionSheet(ActionSheetConfig config)
        {
            var dlg = new ActionSheetContentDialog();

            var vm = new ActionSheetViewModel
            {
                Title   = config.Title,
                Message = config.Message,
                Cancel  = new ActionSheetOptionViewModel(config.Cancel != null, config.Cancel?.Text, () =>
                {
                    dlg.Hide();
                    config.Cancel?.Action?.Invoke();
                }),

                Destructive = new ActionSheetOptionViewModel(config.Destructive != null, config.Destructive?.Text, () =>
                {
                    dlg.Hide();
                    config.Destructive?.Action?.Invoke();
                }),

                Options = config
                          .Options
                          .Select(x => new ActionSheetOptionViewModel(true, x.Text, () =>
                {
                    dlg.Hide();
                    x.Action?.Invoke();
                }, x.ItemIcon ?? config.ItemIcon))
                          .ToList()
            };

            dlg.DataContext = vm;
            IAsyncOperation <ContentDialogResult> dialogTask = null;

            return(this.DispatchAndDispose(
                       //config.UwpSubmitOnEnterKey,
                       //config.UwpCancelOnEscKey,
                       () => dialogTask = dlg.ShowAsync(),
                       () => dialogTask?.Cancel()
                       ));
        }
Esempio n. 4
0
        public override IDisposable ActionSheet(ActionSheetConfig config)
        {
            var dlg = new ActionSheetContentDialog();

            var vm = new ActionSheetViewModel
            {
                Title = config.Title,
                Message = config.Message,
                Cancel = new ActionSheetOptionViewModel(config.Cancel != null, config.Cancel?.Text, () =>
                {
                    dlg.Hide();
                    config.Cancel?.Action?.Invoke();
                }),

                Destructive = new ActionSheetOptionViewModel(config.Destructive != null, config.Destructive?.Text, () =>
                {
                    dlg.Hide();
                    config.Destructive?.Action?.Invoke();
                }),

                Options = config
                    .Options
                    .Select(x => new ActionSheetOptionViewModel(true, x.Text, () =>
                    {
                        dlg.Hide();
                        x.Action?.Invoke();
                    }, x.ItemIcon ?? config.ItemIcon))
                    .ToList()
            };

            dlg.DataContext = vm;
            IAsyncOperation<ContentDialogResult> dialogTask = null;

            return this.DispatchAndDispose(
                () => dialogTask = dlg.ShowAsync(),
                () => dialogTask?.Cancel()
            );
        }