Exemple #1
0
 /// <summary>
 /// Reports an error to the user through a message box.
 /// </summary>
 /// <param name="owner">The top-level window and owner of the error message box.</param>
 /// <param name="message">The error message.</param>
 /// <param name="argument">The error argument.</param>
 /// <param name="exceptionMessage">The exception message.</param>
 /// <returns>The dialog result of the message box.</returns>
 public static DialogResult Show(IWin32Window owner, string message, string argument, string exceptionMessage)
 {
     return(MessageBox.Show(
                owner,
                string.Format(CultureInfo.CurrentCulture, "{0}\r\n\r\n{1}\r\n\r\n{2}", message, argument, exceptionMessage),
                Application.ProductName,
                MessageBoxButtons.OK,
                MessageBoxIcon.Error,
                MessageBoxDefaultButton.Button1,
                MessageBoxReporter.RightToLeftMessageBoxOptions(owner)));
 }
Exemple #2
0
 public static void Invoke(MethodInvoker stuff, IWin32Window owner, string message, string argument)
 {
     try
     {
         stuff();
     }
     catch (Exception ex)
     {
         MessageBoxReporter.Show(owner, message, argument, ex.Message);
     }
 }