Exemple #1
0
        /// <summary>
        /// Show a <see cref="MessageDialog"/>
        /// </summary>
        ///
        /// <param name="grid">Grid to use</param>
        /// <param name="dialogSettings"><see cref="DialogSettings"/> of the <see cref="MessageDialog"/></param>
        ///
        /// <returns>
        /// <see cref="MessageResult"/> which depend of the button clicked by the user
        /// </returns>
        public static async Task <MessageResult> ShowMessageDialog(Grid grid, DialogSettings dialogSettings)
        {
            // Create the message dialog
            MessageDialog messageDialog = new MessageDialog(dialogSettings);

            dialogLoaded = messageDialog;
            grid.Children.Add(messageDialog);

            // Wait the message result and return it
            MessageResult messageResult = await messageDialog.WaitMessageResult();

            return(messageResult);
        }
Exemple #2
0
        /// <summary>
        /// Show a <see cref="MessageDialog"/>
        /// </summary>
        ///
        /// <param name="grid">Grid to use </param>
        /// <param name="dialogSettings">Dialog settings to use</param>
        ///
        /// <returns>
        /// <see cref="ProgressDialog"/> to interact with him
        /// </returns>
        public static async Task <InputDialog> ShowInputDialog(Grid grid, DialogSettings dialogSettings)
        {
            // Create the message dialog
            InputDialog inputDialog = new InputDialog(dialogSettings);

            dialogLoaded = inputDialog;
            grid.Children.Add(inputDialog);

            // Wait the animation is finished
            await Task.Delay(500);

            // Return the dialog
            return(inputDialog);
        }
Exemple #3
0
        /// <summary>
        /// Show a message dialog with a specific dialog settings
        /// </summary>
        ///
        /// <param name="dialogSettings">Dialog settings to use</param>
        public MessageDialog(DialogSettings dialogSettings)
        {
            InitializeComponent();

            Title.Text   = dialogSettings.Title;
            Message.Text = dialogSettings.Message;

            ButtonsStackPanel.HorizontalAlignment = dialogSettings.ButtonAlignment;
            Title.HorizontalAlignment             = dialogSettings.TitleAlignment;
            Message.HorizontalAlignment           = dialogSettings.MessageAlignment;

            Button defaultButton = this.FindName($"{dialogSettings.DefaultButton}Button") as Button;

            defaultButton.IsDefault = true;
            defaultButton.Style     = XUiTheme.XUiDictionaries["XUi_ButtonAccent"] as Style;

            if (dialogSettings.YesText != null && dialogSettings.YesText != "")
            {
                ((TextBlock)YesButton.Content).Text = dialogSettings.YesText;
            }
            else
            {
                YesButton.Visibility = Visibility.Collapsed;
            }

            if (dialogSettings.NoText != null && dialogSettings.NoText != "")
            {
                ((TextBlock)NoButton.Content).Text = dialogSettings.NoText;
            }
            else
            {
                NoButton.Visibility = Visibility.Collapsed;
            }

            if (dialogSettings.Custom1Text != null && dialogSettings.Custom1Text != "")
            {
                ((TextBlock)Custom1Button.Content).Text = dialogSettings.Custom1Text;
                Custom1Button.Visibility = Visibility.Visible;
            }

            if (dialogSettings.Custom2Text != null && dialogSettings.Custom2Text != "")
            {
                ((TextBlock)Custom2Button.Content).Text = dialogSettings.Custom2Text;
                Custom2Button.Visibility = Visibility.Visible;
            }

            this.Loaded += DialogLoaded;
        }
Exemple #4
0
        /// <summary>
        /// Show a <see cref="MessageDialog"/>
        /// </summary>
        ///
        /// <param name="grid">Grid to use</param>
        /// <param name="dialogSettings"><see cref="DialogSettings"/> of the <see cref="MessageDialog"/></param>
        /// <param name="itemSource">Item to set in the combo box</param>
        ///
        /// <returns>
        /// <see cref="object"/> which depend of the seleccted item
        /// </returns>
        public static async Task <object> ShowSelectDialog(Grid grid, DialogSettings dialogSettings, IEnumerable itemSource)
        {
            // Create the message dialog
            SelectDialog selectDialog = new SelectDialog(dialogSettings);

            dialogLoaded = selectDialog;
            grid.Children.Add(selectDialog);

            // Set the item source
            selectDialog.SelectComboBox.ItemsSource   = itemSource;
            selectDialog.SelectComboBox.SelectedIndex = 0;

            // Wait the message result and return it
            await selectDialog.WaitMessageResult();

            return(selectDialog.SelectComboBox.SelectedItem);
        }
Exemple #5
0
        /// <summary>
        /// Show a select dialog with a specific dialog settings
        /// </summary>
        ///
        /// <param name="dialogSettings">Dialog settings to use</param>
        public SelectDialog(DialogSettings dialogSettings)
        {
            InitializeComponent();

            Title.Text = dialogSettings.Title;
            if (!string.IsNullOrEmpty(dialogSettings.Message))
            {
                Message.Visibility = Visibility.Visible;
            }
            Message.Text = dialogSettings.Message;

            ((TextBlock)YesButton.Content).Text = dialogSettings.YesText;
            if (!string.IsNullOrEmpty(dialogSettings.NoText))
            {
                ((TextBlock)NoButton.Content).Text = dialogSettings.NoText;
            }

            this.Loaded += DialogLoaded;
        }
Exemple #6
0
        /// <summary>
        /// Show a <see cref="MessageDialog"/>
        /// </summary>
        ///
        /// <param name="window">Window to use</param>
        /// <param name="dialogSettings"><see cref="DialogSettings"/> of the <see cref="MessageDialog"/></param>
        /// <param name="itemSource">Item to set in the combo box</param>
        ///
        /// <returns>
        /// <see cref="object"/> which depend of the seleccted item
        /// </returns>
        public static async Task <object> ShowSelectDialog(this XUiWindow window, DialogSettings dialogSettings, IEnumerable itemSource)
        {
            // Create the message dialog
            SelectDialog selectDialog = new SelectDialog(dialogSettings);

            dialogLoaded = selectDialog;
            Grid grid = window.Template.FindName("DialogContainer", window) as Grid;

            grid.Children.Add(selectDialog);

            // Set the item source
            selectDialog.SelectComboBox.ItemsSource   = itemSource;
            selectDialog.SelectComboBox.SelectedIndex = 0;

            // Wait the message result and return it
            await selectDialog.WaitMessageResult();

            return(selectDialog.SelectComboBox.SelectedItem);
        }
Exemple #7
0
        /// <summary>
        /// Show a <see cref="MessageDialog"/>
        /// </summary>
        ///
        /// <param name="window">Window to use</param>
        /// <param name="dialogSettings"><see cref="DialogSettings"/> of the <see cref="MessageDialog"/></param>
        ///
        /// <returns>
        /// <see cref="MessageResult"/> which depend of the button clicked by the user
        /// </returns>
        public static async Task <MessageResult> ShowMessageDialog(this XUiWindow window, DialogSettings dialogSettings)
        {
            // Create the message dialog
            MessageDialog messageDialog = new MessageDialog(dialogSettings);

            dialogLoaded = messageDialog;
            Grid grid = window.Template.FindName("DialogContainer", window) as Grid;

            grid.Children.Add(messageDialog);

            // Wait the message result and return it
            MessageResult messageResult = await messageDialog.WaitMessageResult();

            return(messageResult);
        }
Exemple #8
0
        /// <summary>
        /// Show a <see cref="MessageDialog"/>
        /// </summary>
        ///
        /// <param name="window">Window to use </param>
        /// <param name="dialogSettings">Dialog settings to use</param>
        ///
        /// <returns>
        /// <see cref="ProgressDialog"/> to interact with him
        /// </returns>
        public static async Task <InputDialog> ShowInputDialog(this XUiWindow window, DialogSettings dialogSettings)
        {
            // Create the message dialog
            InputDialog inputDialog = new InputDialog(dialogSettings);

            dialogLoaded = inputDialog;
            Grid grid = window.Template.FindName("DialogContainer", window) as Grid;

            grid.Children.Add(inputDialog);

            // Wait the animation is finished
            await Task.Delay(500);

            // Return the dialog
            return(inputDialog);
        }