Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Iyemon-018/8f129f635c3738c8b6e1c472db367fa4 to your computer and use it in GitHub Desktop.
Save Iyemon-018/8f129f635c3738c8b6e1c472db367fa4 to your computer and use it in GitHub Desktop.
using System;
using System.Threading.Tasks;
using MaterialDesign.Dialog.Example.Dialogs;
using MaterialDesign.Dialog.Example.Dialogs.ViewModels;
using MaterialDesignThemes.Wpf;
namespace MaterialDesign.Dialog.Example.Services
{
public class DialogService : IDialogService
{
private readonly string _identifier;
public DialogService(string identifier)
{
_identifier = identifier;
}
public async Task<bool> Question(string message)
{
MessageDialog dialog = new MessageDialog
{
DataContext = new MessageDialogViewModel
{
Message = message
}
};
object result = await DialogHost.Show(dialog, _identifier);
return (result is bool selectedResult) && selectedResult;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment