示例#1
0
        public async Task <string> ShowInputDialog(string title, string message, string buttonok, string defaulttext, DialogMode mode)
        {
            if (Configuration.ShowFullscreenDialogs)
            {
                var dialog = new AdvancedInputDialog(BaseWindow,
                                                     new MetroDialogSettings()
                {
                    AffirmativeButtonText = buttonok,
                    DefaultText           = defaulttext,
                    NegativeButtonText    = Application.Current.Resources["Cancel"].ToString(),
                    ColorScheme           = MetroDialogColorScheme.Theme,
                    AnimateHide           = ShowHideAnimation(mode),
                    AnimateShow           = ShowShowAnimation(mode)
                })
                {
                    Title = title, Message = message
                };

                await BaseWindow.ShowMetroDialogAsync(dialog);

                var result = await dialog.WaitForButtonPressAsync();

                await dialog._WaitForCloseAsync();

                var foo = BaseWindow.HideMetroDialogAsync(dialog);
                return(result);
            }
            else
            {
                var inputdialog = new InputDialog(title, message, buttonok, defaulttext)
                {
                    Owner = BaseWindow
                };
                await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => inputdialog.ShowDialog()));

                return(inputdialog.ResultText);
            }
        }
示例#2
0
        public async Task<string> ShowInputDialog(string title, string message, string buttonok, string defaulttext, DialogMode mode)
        {
            if (Configuration.ShowFullscreenDialogs)
            {
                var dialog = new AdvancedInputDialog(BaseWindow,
                    new MetroDialogSettings()
                    {
                        AffirmativeButtonText = buttonok,
                        DefaultText = defaulttext,
                        NegativeButtonText = Application.Current.Resources["Cancel"].ToString(),
                        ColorScheme = MetroDialogColorScheme.Theme,
                        AnimateHide = ShowHideAnimation(mode),
                        AnimateShow = ShowShowAnimation(mode)
                    }) { Title = title, Message = message };

                await BaseWindow.ShowMetroDialogAsync(dialog);
                var result = await dialog.WaitForButtonPressAsync();
                await dialog._WaitForCloseAsync();
                var foo = BaseWindow.HideMetroDialogAsync(dialog);
                return result;
            }
            else
            {
                var inputdialog = new InputDialog(title, message, buttonok, defaulttext) { Owner = BaseWindow };
                await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => inputdialog.ShowDialog()));
                return inputdialog.ResultText;
            }
        }