Exemple #1
0
        /// <summary>
        /// Shows a dialog to show <see cref="Text"/>.
        /// </summary>
        /// <param name="Message"> A Message that will be shown in dialog.</param>
        /// <param name="DialogHost"> [Optional] Name of DialogHost where dialog will be shown. (Default "MainDialogHost" ) </param>
        /// <param name="AffirmativeButton"> [Optional] Text of Affirmative Button. (Default "OK" ) </param>
        /// <returns>Nothing</returns>
        /// <example>
        /// This sample shows how to call the <see cref="ShowText"/> method.
        /// <code>
        /// Dmanager.ShowText("Your Message","MainDialogHost" , "OK");
        /// </code>
        /// </example>
        ///
        public void ShowText(string Message, [Optional] string DialogHost, [Optional] string AffirmativeButton)
        {
            string host      = DialogHost ?? "MainDialogHost";
            var    viewModel = new OkDialogViewModel
            {
                Message = Message,
                AffirmativeButtonText = AffirmativeButton ?? "OK"
            };
            var dialog = new OkDialog(viewModel);

            MaterialDesignThemes.Wpf.DialogHost.Show(dialog, host);
        }
Exemple #2
0
        /// <summary>
        /// Shows a dialog to show <see cref="Text"/>. An Async variant of showtext for getting bool return
        /// </summary>
        /// <param name="Message"> A Message that will be shown in dialog.</param>
        /// <param name="DialogHost"> [Optional] Name of DialogHost where dialog will be shown. (Default "MainDialogHost" ) </param>
        /// <param name="AffirmativeButton"> [Optional] Text of Affirmative Button. (Default "OK" ) </param>
        /// <returns>Nothing</returns>
        /// <example>
        /// This sample shows how to call the <see cref="InputDialog"/> method.
        /// <code>
        /// var result = await Dmanager.ShowText("Your Message","MainDialogHost" , "OK");
        /// </code>
        /// </example>
        ///
        public async Task <bool> ShowTextAsync(string Message, [Optional] string DialogHost, [Optional] string AffirmativeButton)
        {
            string host      = DialogHost ?? "MainDialogHost";
            var    viewModel = new OkDialogViewModel
            {
                Message = Message,
                AffirmativeButtonText = AffirmativeButton ?? "OK"
            };
            var dialog = new OkDialog(viewModel);
            var result = (bool)await MaterialDesignThemes.Wpf.DialogHost.Show(dialog, host);

            return(result);
        }