Esempio n. 1
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> ShowOkCancel(string Message, [Optional] string DialogHost, [Optional] string AffirmativeButton, [Optional] string NegativeButton)
        {
            string host      = DialogHost ?? "MainDialogHost";
            var    viewModel = new OkCancelDialogViewModel
            {
                Message = Message,
                AffirmativeButtonText = AffirmativeButton ?? "OK",
                NegativeButtonText    = NegativeButton ?? "CANCEL"
            };
            var dialog = new OkCancelDialog(viewModel);
            var result = (bool)await MaterialDesignThemes.Wpf.DialogHost.Show(dialog, host);

            return(result);
        }
Esempio n. 2
0
 public OkCancelDialog(OkCancelDialogViewModel viewModel)
 {
     InitializeComponent();
     DataContext = viewModel;
 }