Ejemplo n.º 1
0
 /// <summary>
 /// Creates an standard input dialog which also executes an action.
 /// </summary>
 /// <param name="title">Title of the input dialog.</param>
 /// <param name="message">Message of the input dialog.</param>
 /// <param name="dialogAction">Action to execute by the primary button.</param>
 /// <param name="primaryButton">Label of the primary button of the input dialog. Default value "Ok".</param>
 /// <param name="secondaryButton">Label of the secondary button of the input dialog. Default value "Cancel".</param>
 /// <param name="settings">Input dialog behavior/option settings.</param>
 public InputDialog(string title, string message, Func <string, bool> dialogAction,
                    string primaryButton         = null, string secondaryButton = null,
                    InputDialogSettings settings = null)
 {
     this.InitializeComponent();
     this.Initialize(title, message, primaryButton, secondaryButton, settings);
     this.ViewModel.DialogAction = dialogAction;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Show an input dialog which also executes an async action.
        /// </summary>
        /// <param name="title">Title of the input dialog.</param>
        /// <param name="message">Message of the input dialog.</param>
        /// <param name="primaryButton">Label of the primary button of the input dialog.</param>
        /// <param name="secondaryButton">Label of the secondary button of the input dialog.</param>
        /// <param name="dialogActionAsync">Async action to do by the primary button.</param>
        /// <param name="settings">Input dialog behavior/option settings.</param>
        /// <returns>The dialog action result as <see cref="bool"/> value.</returns>
        public static async Task <bool> ShowInputAsyncActionDialogAsync(string title, string message,
                                                                        string primaryButton, string secondaryButton, Func <string, Task <bool> > dialogActionAsync,
                                                                        InputDialogSettings settings = null)
        {
            var dialog = InputDialogInstance =
                new InputDialog(title, message, dialogActionAsync, primaryButton, secondaryButton, settings);

            return(await dialog.ShowAsyncQueueBool());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Show an standard input dialog.
        /// </summary>
        /// <param name="title">Title of the input dialog.</param>
        /// <param name="message">Message of the input dialog.</param>
        /// <param name="settings">Input dialog behavior/option settings.</param>
        public static async Task <string> ShowInputDialogAsync(string title, string message,
                                                               InputDialogSettings settings = null)
        {
            var dialog = InputDialogInstance =
                new InputDialog(title, message, null, null, settings);
            var result = await dialog.ShowAsyncQueueBool();

            return(result ? dialog.ViewModel.InputText : null);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialize the input dialog
        /// </summary>
        /// <param name="title">Title of the input dialog.</param>
        /// <param name="message">Message of the input dialog.</param>
        /// <param name="primaryButton">Label of the primary button of the input dialog. Default value "Ok".</param>
        /// <param name="secondaryButton">Label of the secondary button of the input dialog. Default value "Cancel".</param>
        /// <param name="settings">Input dialog behavior/option settings.</param>
        private void Initialize(string title, string message, string primaryButton = null,
                                string secondaryButton = null, InputDialogSettings settings = null)
        {
            this.ViewModel.TitleText            = title;
            this.ViewModel.MessageText          = message;
            this.ViewModel.PrimaryButtonLabel   = primaryButton ?? this.ViewModel.OkText;
            this.ViewModel.SecondaryButtonLabel = secondaryButton ?? this.ViewModel.CancelText;

            // Create default input settings if null
            this.ViewModel.Settings = settings ?? new InputDialogSettings();
        }
        public Task <string> PromptForTitle()
        {
            var settings = new InputDialogSettings()
            {
                DefaultText = this.L("stat_comparer", "new_comparison_default_title"),
            };

            return(DialogManager.Instance.ShowInputDialogAsync(this.L("stat_comparer", "new_comparison_title_prompt_dialog_title"),
                                                               this.L("stat_comparer", "new_comparison_title_prompt_dialog_message"),
                                                               settings));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates an standard input dialog.
 /// </summary>
 /// <param name="title">Title of the input dialog.</param>
 /// <param name="message">Message of the input dialog.</param>
 /// <param name="primaryButton">Label of the primary button of the input dialog. Default value "Ok".</param>
 /// <param name="secondaryButton">Label of the secondary button of the input dialog. Default value "Cancel".</param>
 /// <param name="settings">Input dialog behavior/option settings.</param>
 public InputDialog(string title, string message, string primaryButton = null,
                    string secondaryButton = null, InputDialogSettings settings = null)
 {
     this.InitializeComponent();
     this.Initialize(title, message, primaryButton, secondaryButton, settings);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Show an input dialog which also executes an action.
        /// </summary>
        /// <param name="title">Title of the input dialog.</param>
        /// <param name="message">Message of the input dialog.</param>
        /// <param name="dialogAction">Action to do by the primary button.</param>
        /// <param name="settings">Input dialog behavior/option settings.</param>
        /// <returns>The dialog action result as <see cref="bool"/> value.</returns>
        public static async Task <bool> ShowInputActionDialogAsync(string title, string message,
                                                                   Func <string, bool> dialogAction, InputDialogSettings settings = null)
        {
            var dialog = InputDialogInstance =
                new InputDialog(title, message, dialogAction, null, null, settings);

            return(await dialog.ShowAsyncQueueBool());
        }