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; } _messageBox.Close(); _messageBox = null; }
public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image) { _messageBox = new winMessageBox { txtMsg = { Text = text }, MessageTitle = { Text = caption } }; SetVisibilityOfButtons(button); SetImageOfMessageBox(image); _messageBox.ShowDialog(); return(_result); }