public static async Task <bool?> Show(string message, string caption, MessageBoxButton buttons) { bool?result = null; await Application.Current.Dispatcher.InvokeAsync(async() => { GenericDialog dlg = new GenericDialog(); dlg.Message = message; switch (buttons) { case MessageBoxButton.OK: { dlg.Left = null; dlg.Right = "OK"; break; } case MessageBoxButton.OKCancel: { dlg.Left = "Cancel"; dlg.Right = "OK"; break; } case MessageBoxButton.YesNoCancel: throw new NotImplementedException(); case MessageBoxButton.YesNo: { dlg.Left = "No"; dlg.Right = "Yes"; break; } } result = await ViewService.ShowDialog <GenericDialog, bool?>(caption, dlg); }); return(result); }
public static async Task <bool?> Show(string message, string caption, MessageBoxButton buttons) { await Dispatch.MainThread(); GenericDialog dlg = new GenericDialog(); dlg.Message = message; switch (buttons) { case MessageBoxButton.OK: { dlg.Left = null; dlg.Right = "OK"; break; } case MessageBoxButton.OKCancel: { dlg.Left = "Cancel"; dlg.Right = "OK"; break; } case MessageBoxButton.YesNoCancel: throw new NotImplementedException(); case MessageBoxButton.YesNo: { dlg.Left = "No"; dlg.Right = "Yes"; break; } } return(await ViewService.ShowDialog <GenericDialog, bool?>(caption, dlg)); }