public void Alert(string message, string title = "Alert") { SafeInvoke(() => { var dialog = new MessageBoxMetroWindow { Owner = (Window)ShellHandle, DataContext = new MessageBoxViewModel(MessageBoxType.OK, MessageBoxIcon.Alert) { Title = title, Message = message, } }; ShellHandle = dialog; dialog.ShowDialog(); ShellHandle = dialog.Owner; }); }
public bool Confirm(string message, string title) { var result = false; SafeInvoke(() => { var vm = new MessageBoxViewModel(MessageBoxType.YesNo, MessageBoxIcon.YesNo) { Title = title, Message = message, }; var dialog = new MessageBoxMetroWindow { Owner = (Window)ShellHandle, DataContext = vm }; ShellHandle = dialog; dialog.ShowDialog(); ShellHandle = dialog.Owner; if (vm.DialogResult.HasValue) { result = vm.DialogResult.Value; } }); return result; }
public bool? ConfirmOrCancel(string message, string title = "Confirm") { bool? result = null; SafeInvoke(() => { var vm = new MessageBoxViewModel(MessageBoxType.YesNoCancel, MessageBoxIcon.YesNo) { Title = title, Message = message, }; var dialog = new MessageBoxMetroWindow { Owner = (Window)ShellHandle, DataContext = vm }; ShellHandle = dialog; dialog.ShowDialog(); ShellHandle = dialog.Owner; result = vm.DialogResult; }); return result; }