コード例 #1
0
 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;
 }
コード例 #2
0
 public static MessageBoxResult Show
     (string caption, string text,
     MessageBoxButton button, MessageBoxImage image)
 {
     _messageBox = new WpfMessageBox
     {
         txtMsg = { Text = text }, MessageTitle = { Text = caption }
     };
     SetVisibilityOfButtons(button);
     SetImageOfMessageBox(image);
     _messageBox.ShowDialog();
     return(_result);
 }