/// <summary> /// Shows a dialog to get <see cref="User Input"/> with custom DialogHost. Use in async method /// </summary> /// <param name="Message"> A Message that will be shown in dialog.</param> /// <param name="DialogHost"> Name of DialogHost where dialog will be shown.</param> /// <returns>String</returns> /// <example> /// This sample shows how to call the <see cref="InputDialog"/> method. /// <code> /// var result = await Dmanager.InputDialog("Your Message","MainDialogHost"); /// </code> /// </example> public async Task <string> InputDialog(string Message, string DialogHost) { var viewModel = new TextInputDialogViewModel { Message = Message }; var dialog = new TextInputDialog(viewModel); var result = (bool)await MaterialDesignThemes.Wpf.DialogHost.Show(dialog, DialogHost); if (result) { return(viewModel.Text); } return(""); }
/// <summary> /// Shows a dialog to get <see cref="User Input"/> with custom buttons text. Use in async method /// </summary> /// <param name="Message"> A Message that will be shown in dialog.</param> /// <param name="AffirmativeButton"> Text of Affirmative Button </param> /// <param name="NegativeButton"> Text of Negative Button</param> /// <returns>String</returns> /// <example> /// This sample shows how to call the <see cref="InputDialog"/> method. /// <code> /// var result = await Dmanager.InputDialog("Your Message","MainDialogHost" , "OK","Cancel"); /// </code> /// </example> public async Task <string> InputDialog(string Message, string AffirmativeButton, string NegativeButton) { var viewModel = new TextInputDialogViewModel { Message = Message, AffirmativeButtonText = AffirmativeButton, NegativeButtonText = NegativeButton }; var dialog = new TextInputDialog(viewModel); var result = (bool)await MaterialDesignThemes.Wpf.DialogHost.Show(dialog, "MainDialogHost"); if (result) { return(viewModel.Text); } return(""); }