예제 #1
0
		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;
			});
		}
예제 #2
0
		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;
		}
예제 #3
0
		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;
		}