private void Button_Click(object sender, RoutedEventArgs e) { if (sender == btnOk) { result = MessageBoxResult.OK; } else if (sender == btnYes) { result = MessageBoxResult.Yes; } else if (sender == btnNo) { result = MessageBoxResult.No; } else if (sender == btnCancel) { result = MessageBoxResult.Cancel; } else { result = MessageBoxResult.None; } allowClosing = true; Close(); messageBox = null; }
public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image) { messageBox = new JobArrangerMessageBox(); messageBox.txtMsg.Text = text; messageBox.Title = caption; setVisibilityOfButtons(button); setImageOfMessageBox(image); messageBox.ShowDialog(); return(result); }