コード例 #1
0
 public void NotifyUserOfProblem(IRepeatNoticePolicy policy, Exception exception, string message)
 {
     foreach (var reporter in Reporters)
     {
         reporter.NotifyUserOfProblem(policy, exception, message);
     }
 }
コード例 #2
0
        public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy,
									string alternateButton1Label,
									ErrorResult resultIfAlternateButtonPressed,
									string message)
        {
            if (!policy.ShouldShowMessage(message))
            {
                return ErrorResult.OK;
            }

            if (ErrorReport.IsOkToInteractWithUser)
            {
                var dlg = new ProblemNotificationDialog(message, UsageReporter.AppNameToUseInDialogs + " Problem")
                {
                    ReoccurenceMessage = policy.ReoccurenceMessage

                };
                if (!string.IsNullOrEmpty(alternateButton1Label))
                {
                    dlg.EnableAlternateButton1(alternateButton1Label, GetDialogResultForErrorResult(resultIfAlternateButtonPressed));
                }
                return GetErrorResultForDialogResult(dlg.ShowDialog());
            }
            else
            {
                throw new ErrorReport.ProblemNotificationSentToUserException(message);
            }
        }
コード例 #3
0
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     if (policy.ShouldShowErrorReportDialog(exception))
     {
         WriteExceptionToConsole(exception, null, Severity.NonFatal);
     }
 }
コード例 #4
0
 // ENHANCE: I think it would be good if ProblemReportApi could be split out.
 // Part of it is related to serving the API requests needed to make the Problem Report Dialog work. That should stay in ProblemReportApi.cs.
 // Another part of it is related to bring up a browser dialog. I think that part should be moved here into this HtmlErrorReporter class.
 // It'll be a big job though.
 //
 // Also, ProblemReportApi and this class share some parallel ideas because this class was derived from ProblemReportApi,
 // but they're not 100% identical because this class revamped some of those ideas.
 // So those will need to be merged.
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     // Note: I think it's better to call ProblemReportApi directly instead of through NonFatalProblem first.
     // Otherwise you have to deal with NonFatalProblem's ModalIf, PassiveIf parameters.
     // And you also have to worry about whether Sentry will happen twice.
     ProblemReportApi.ShowProblemDialog(GetControlToUse(), exception, null, ProblemLevel.kNonFatal);
 }
コード例 #5
0
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     if (policy.ShouldShowErrorReportDialog(exception))
     {
         WriteExceptionToConsole(exception, null, Severity.NonFatal);
     }
 }
コード例 #6
0
        /// <summary>
        /// Notifies the user of a problem, using a browser-based dialog.
        /// A Report and a secondary action button are potentially available. This method
        /// will return a return code to the caller to indicate which button was pressed.
        /// It is the caller's responsibility to perform any appropriate actions based on the button click.
        /// </summary>
        /// <param name="policy">Checks if we should notify the user, based on the contents of {message}</param>
        /// <param name="reportButtonLabel">The localized text that goes on the Report button. null means Use Default ("Report"). Empty string means disable the button</param>
        /// <param name="resultIfReportButtonPressed">This is the value that this method should return so that the caller
        /// can know if the Report button was pressed, and if so, the caller can invoke whatever actions are desired.</param>
        /// <param name="secondaryActionButtonLabel">The localized text that goes on the Report button. Either null or empty string means disable the button</param>
        /// <param name="resultIfSecondaryPressed">This is the value that this method should return so that the caller
        /// can know if the secondary action button was pressed, and if so, the caller can invoke whatever actions are desired.</param>
        /// <param name="messageFmt">The message to show to the user</param>
        /// <param name="args">The args to pass to the {messageFmt} format string</param>
        /// <returns>If closed normally, returns ErrorResult.OK
        /// If the report button was pressed, returns {resultIfAlternateButtonPressed}.
        /// If the secondary action button was pressed, returns {this.SecondaryActionResult} if that is non-null; otherwise falls back to {resultIfAlternateButtonPressed}
        /// If an exception is thrown while executing this function, returns ErrorResult.Abort.
        /// </returns>
        public ErrorResult CustomNotifyUserManual(
            IRepeatNoticePolicy policy,
            string reportButtonLabel,             /* The Report button is equivalent to the Details button in libpalaso's WinFormsErrorReporter of {alternateButton1} in libpalaso's ErrorReport */
            ErrorResult resultIfReportButtonPressed,
            string secondaryActionButtonLabel,    /* An additional action such as Retry / etc */
            ErrorResult resultIfSecondaryPressed,
            string messageFmt,
            params object[] args)
        {
            Debug.Assert(!System.Threading.Monitor.IsEntered(_lock), "Expected object not to have been locked yet, but the current thread already aquired it earlier. Bug?");
            // Block until lock acquired
            System.Threading.Monitor.Enter(_lock);

            try
            {
                SetExtraParamsForCustomNotifyManual(reportButtonLabel, secondaryActionButtonLabel, resultIfSecondaryPressed);

                // Note: It's more right to go through ErrorReport than to invoke
                // our NotifyUserOfProblem directly. ErrorReport has some logic,
                // and it's also necessary if we have a CompositeErrorReporter
                return(ErrorReport.NotifyUserOfProblem(policy, reportButtonLabel, resultIfReportButtonPressed, messageFmt, args));
            }
            finally
            {
                System.Threading.Monitor.Exit(_lock);
            }
        }
コード例 #7
0
        public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy,
                                               string alternateButton1Label,
                                               ErrorResult resultIfAlternateButtonPressed,
                                               string message)
        {
            if (!policy.ShouldShowMessage(message))
            {
                return(ErrorResult.OK);
            }

            if (ErrorReport.IsOkToInteractWithUser)
            {
                var dlg = new ProblemNotificationDialog(message, UsageReporter.AppNameToUseInDialogs + " Problem")
                {
                    ReoccurenceMessage = policy.ReoccurenceMessage
                };
                if (!string.IsNullOrEmpty(alternateButton1Label))
                {
                    dlg.EnableAlternateButton1(alternateButton1Label, GetDialogResultForErrorResult(resultIfAlternateButtonPressed));
                }
                return(GetErrorResultForDialogResult(dlg.ShowDialog()));
            }
            else
            {
                throw new ErrorReport.ProblemNotificationSentToUserException(message);
            }
        }
コード例 #8
0
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     foreach (var reporter in Reporters)
     {
         reporter.ReportNonFatalException(exception, policy);
     }
 }
コード例 #9
0
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     if (policy.ShouldShowErrorReportDialog(exception))
     {
         ErrorReporter.ReportException(exception, m_registryKey, m_supportEmailAddress, m_parentForm, false);
     }
 }
コード例 #10
0
 public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label,
                                        ErrorResult resultIfAlternateButtonPressed, string message)
 {
     return(policy.ShouldShowMessage(message) &&
            ErrorReporter.ReportException(new Exception(message), m_registryKey, m_supportEmailAddress, m_parentForm, false) ?
            ErrorResult.Abort : ErrorResult.Ignore);
 }
コード例 #11
0
 /// <summary>
 /// Customized version of ErrorReport.NotifyUserOfProblem that allows customization of the button labels and what they do.
 /// (This will eventually call <see cref="ErrorReport.NotifyUserOfProblem(IRepeatNoticePolicy, Exception, string, object[])"/>)
 /// </summary>
 /// <param name="message">The message to report to the user.</param>
 /// <param name="exception">Optional - Any exception accompanying the message.</param>
 /// <param name="reportButtonLabel">Optional - The localized text of the report button. Pass null to use the default behavior.</param>
 /// <param name="onReportButtonPressed">Optional - The action to execute after the report button is pressed. Pass null to use the default behavior.</param>
 /// <param name="extraButtonLabel">Optional - The localized text of the secondary action button. Pass null to use the default behavior.</param>
 /// <param name="onExtraButtonPressed">Optional - The action to execute after the secondary action button is pressed. Pass null to use the default behavior.</param>
 /// <param name="policy">Optional - The policy for how often to show the message. If null or not set, then ShowAlwaysPolicy will be used.</param>
 public static void NotifyUserOfProblem(string message, Exception exception = null,
                                        string reportButtonLabel            = null, Action <Exception, string> onReportButtonPressed = null,
                                        string extraButtonLabel             = null, Action <Exception, string> onExtraButtonPressed  = null,
                                        IRepeatNoticePolicy policy          = null)
 {
     Program.ErrorReporter.SetNotifyUserOfProblemCustomParams(reportButtonLabel, onReportButtonPressed, extraButtonLabel, onExtraButtonPressed);
     ErrorReport.NotifyUserOfProblem(policy ?? new ShowAlwaysPolicy(), exception, message);
 }
コード例 #12
0
ファイル: ErrorReport.cs プロジェクト: venukommu/libpalaso
 /// <summary>
 /// Allow user to report an exception even though the program doesn't need to exit
 /// </summary>
 public static void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     if (s_justRecordNonFatalMessagesForTesting)
     {
         ErrorReport.s_previousNonFatalException = exception;
         return;
     }
     _errorReporter.ReportNonFatalException(exception, policy);
     UsageReporter.ReportException(false, null, exception, null);
 }
コード例 #13
0
ファイル: ErrorReport.cs プロジェクト: venukommu/libpalaso
        public static void NotifyUserOfProblem(IRepeatNoticePolicy policy, Exception error, string messageFmt, params object[] args)
        {
            var result = NotifyUserOfProblem(policy, "Details", ErrorResult.Yes, messageFmt, args);

            if (result == ErrorResult.Yes)
            {
                OnShowDetails(error, string.Format(messageFmt, args));
            }

            UsageReporter.ReportException(false, null, error, String.Format(messageFmt, args));
        }
コード例 #14
0
 /// <summary>
 /// An adapter around the 5-argument overload of LibPalaso's ErrorReport's NotifyUserOfProblem (Manual Invoke version)
 /// This adapter exposes two additional parameters to control the secondary action button
 ///
 /// This version allows you to add a Report and Secondary Action button, if desired
 ///
 /// This version does not automatically invoke any actions upon button presses,
 /// but relies on returning an ErrorResult to indicate which button was pressed
 /// The caller should check the return value for control flow and take whatever action it desires accordingly.
 /// </summary>
 /// <param name="policy">The policy that indicates how often the message should be shown</param>
 /// <param name="reportButtonLabel">The localized text of the button that will lead to the Problem Report Dialog (report an issue to the issue-tracking system)</param>
 /// <param name="resultIfReportButtonPressed">The return value that this function should return to indicate to the caller that the Report button was pressed</param>
 /// <param name="secondaryActionButtonLabel">The localized text of the button that initiates the secondary action.</param>
 /// <param name="resultIfSecondaryPressed">The return value that this function should return to indicate to the caller that the secondary action button was pressed</param>
 /// <param name="messageFmt">The message to display to the user. May be a format string</param>
 /// <param name="args">Optional. The args to pass to the messageFmt format string.</param>
 /// <returns>ErrorResult.OK if OK button pressed, or {resultIfReportButtonPressed} if the user clicks the Report button, or {resultIfSecondaryActionButtonPressed} if the user clicks the secondary action button. Or ErrorResult.Abort if error.</returns>
 public static ErrorResult NotifyUserOfProblem(
     IRepeatNoticePolicy policy,
     string reportButtonLabel,             /* The Report button is equivalent to the Details button in libpalaso's WinFormsErrorReporter of {alternateButton1} in libpalaso's ErrorReport */
     ErrorResult resultIfReportButtonPressed,
     string secondaryActionButtonLabel,    /* An additional action such as Retry / etc */
     ErrorResult resultIfSecondaryPressed,
     string messageFmt,
     params object[] args)
 {
     return(HtmlErrorReporter.Instance.CustomNotifyUserManual(policy, reportButtonLabel, resultIfReportButtonPressed, secondaryActionButtonLabel, resultIfSecondaryPressed, messageFmt, args));
 }
コード例 #15
0
 /// <summary>
 /// Allow user to report an exception even though the program doesn't need to exit
 /// </summary>
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     if (policy.ShouldShowErrorReportDialog(exception))
     {
         if (ErrorReport.IsOkToInteractWithUser)
         {
             ExceptionReportingDialog.ReportException(exception, null, false);
         }
         else
         {
             throw new ErrorReport.NonFatalExceptionWouldHaveBeenMessageShownToUserException(exception);
         }
     }
 }
コード例 #16
0
 /// <summary>
 /// Allow user to report an exception even though the program doesn't need to exit
 /// </summary>
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     if (policy.ShouldShowErrorReportDialog(exception))
     {
         if (ErrorReport.IsOkToInteractWithUser)
         {
             ExceptionReportingDialog.ReportException(exception, null, false);
         }
         else
         {
             throw new ErrorReport.NonFatalExceptionWouldHaveBeenMessageShownToUserException(exception);
         }
     }
 }
コード例 #17
0
ファイル: ErrorReport.cs プロジェクト: venukommu/libpalaso
        public static ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy,
                                                      string alternateButton1Label,
                                                      ErrorResult resultIfAlternateButtonPressed,
                                                      string messageFmt,
                                                      params object[] args)
        {
            var message = string.Format(messageFmt, args);

            if (s_justRecordNonFatalMessagesForTesting)
            {
                s_previousNonFatalMessage = message;
                return(ErrorResult.OK);
            }
            return(_errorReporter.NotifyUserOfProblem(policy, alternateButton1Label, resultIfAlternateButtonPressed, message));
        }
コード例 #18
0
        public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label, ErrorResult resultIfAlternateButtonPressed, string message)
        {
            ErrorResult?primaryResult = null;

            foreach (var reporter in Reporters)
            {
                var currResult = reporter.NotifyUserOfProblem(policy, alternateButton1Label, resultIfAlternateButtonPressed, message);

                if (reporter == PrimaryReporter)
                {
                    primaryResult = currResult;
                }
            }

            return(primaryResult.Value);
        }
コード例 #19
0
        /// <summary>
        /// Notifies the user of a problem, using a browser-based dialog.
        /// Note: This is designed to be called by LibPalaso's ErrorReport class.
        /// </summary>
        /// <param name="policy">Checks if we should notify the user, based on the contents of {message}</param>
        /// <param name="alternateButton1Label">The text that goes on the Report button. However, if speicfied, this.ReportButtonLabel takes precedence over this parameter</param>
        /// <param name="resultIfAlternateButtonPressed">This is the value that this method should return so that the caller (mainly LibPalaso ErrorReport)
        /// can know if the alternate button was pressed, and if so, invoke whatever actions are desired.</param>
        /// <param name="message">The message to show to the user</param>
        /// <returns>If closed normally, returns ErrorResult.OK
        /// If the report button was pressed, returns {resultIfAlternateButtonPressed}.
        /// If the secondary action button was pressed, returns {this.SecondaryActionResult} if that is non-null; otherwise falls back to {resultIfAlternateButtonPressed}
        /// If an exception is throw while executing this function, returns ErrorResult.Abort.
        /// </returns>
        public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label, ErrorResult resultIfAlternateButtonPressed, string message)
        {
            // Let this thread try to acquire the lock, if necessary
            // Note: It is expected that sometimes this function will need to acquire the lock for this thread,
            //       and sometimes it'll already be acquired.
            //       The reason is because for legacy code that calls ErrorReport directly, this function is the first entry point into this class.
            //       But for code that needs the new secondaryAction functionality, it needs to enter through CustomNotifyUser*().
            //       That function wants to acquire a lock so that the instance variables it sets aren't modified by any other thread before
            //       entering this NotifyUserOfProblem() function.
            bool wasAlreadyLocked = System.Threading.Monitor.IsEntered(_lock);

            if (!wasAlreadyLocked)
            {
                System.Threading.Monitor.Enter(_lock);
            }

            try
            {
                ErrorResult result = ErrorResult.OK;
                if (policy.ShouldShowMessage(message))
                {
                    ErrorReport.OnShowDetails = null;
                    var reportButtonLabel = GetReportButtonLabel(alternateButton1Label);
                    result = ShowNotifyDialog(ProblemLevel.kNotify, message, null, reportButtonLabel, resultIfAlternateButtonPressed, this.SecondaryActionButtonLabel, this.SecondaryActionResult);
                }

                ResetToDefaults();

                return(result);
            }
            catch (Exception e)
            {
                var fallbackReporter = new WinFormsErrorReporter();
                fallbackReporter.ReportNonFatalException(e, new ShowAlwaysPolicy());

                return(ErrorResult.Abort);
            }
            finally
            {
                // NOTE: Each thread needs to make sure it calls Exit() the same number of times as it calls Enter()
                // in order for other threads to be able to acquire the lock later.
                if (!wasAlreadyLocked)
                {
                    System.Threading.Monitor.Exit(_lock);
                }
            }
        }
コード例 #20
0
		public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label,
			ErrorResult resultIfAlternateButtonPressed, string message)
		{
			if (!policy.ShouldShowMessage(message))
			{
				return ErrorResult.OK;
			}

			if (ErrorReport.IsOkToInteractWithUser)
			{
				Console.WriteLine(message);
				Console.WriteLine(policy.ReoccurenceMessage);
				return ErrorResult.OK;
			}

			throw new ErrorReport.ProblemNotificationSentToUserException(message);
		}
コード例 #21
0
        public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label,
                                               ErrorResult resultIfAlternateButtonPressed, string message)
        {
            if (!policy.ShouldShowMessage(message))
            {
                return(ErrorResult.OK);
            }

            if (ErrorReport.IsOkToInteractWithUser)
            {
                Console.WriteLine(message);
                Console.WriteLine(policy.ReoccurenceMessage);
                return(ErrorResult.OK);
            }

            throw new ErrorReport.ProblemNotificationSentToUserException(message);
        }
コード例 #22
0
        public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label, ErrorResult resultIfAlternateButtonPressed, string message)
        {
            var returnResult = ErrorResult.OK;

            ReportButtonLabel = GetReportButtonLabel(alternateButton1Label);

            OnReportButtonPressed = (exceptionParam, messageParam) =>
            {
                returnResult = resultIfAlternateButtonPressed;
            };

            var control          = GetControlToUse();
            var forceSynchronous = true;

            SafeInvoke.InvokeIfPossible("Show Error Reporter", control, forceSynchronous, () =>
            {
                NotifyUserOfProblem(policy, null, message);
            });
            return(returnResult);
        }
コード例 #23
0
        /// <summary>
        /// Notifies the user of a problem, using a browser-based dialog.
        /// A Report and a secondary action button are potentially available. This method
        /// will automatically invoke the corresponding Action for each button that is clicked.
        /// </summary>
        /// <param name="reportButtonLabel">The localized text that goes on the Report button. null means Use Default ("Report"). Empty string means disable the button</param>
        /// <param name="secondaryActionButtonLabel">The localized text that goes on the Report button. Either null or empty string means disable the button</param>
        /// <param name="onSecondaryActionPressed">Optional - The action which will be invoked if secondary action button is clicked. You may pass null, but that will invoke the ErrorReport default (which is to report a non-fatal exception). ErrorReport.cs will pass the Action an exception ({error}) and a string (the {message} formatted with {args}, which you will probably ignore.</param>
        /// <param name="policy">Checks if we should notify the user, based on the contents of {message}</param>
        /// <param name="error">Optional - Any exception that was encountered that should be included in the notification/report. May be null</param>
        /// <param name="message">The message to show to the user. May be a format string.</param>
        /// <param name="args">The args to pass to the {message} format string</param>
        public void CustomNotifyUserAuto(string reportButtonLabel, string secondaryActionButtonLabel, Action <Exception, string> onSecondaryActionPressed,
                                         IRepeatNoticePolicy policy, Exception error, string message, params object[] args)
        {
            Debug.Assert(!System.Threading.Monitor.IsEntered(_lock), "Expected object not to have been locked yet, but the current thread already aquired it earlier. Bug?");
            // Block until lock acquired
            System.Threading.Monitor.Enter(_lock);

            try
            {
                SetExtraParamsForCustomNotifyAuto(reportButtonLabel, secondaryActionButtonLabel, onSecondaryActionPressed);

                // Note: It's more right to go through ErrorReport than to invoke
                // our NotifyUserOfProblem directly. ErrorReport has some logic,
                // and it's also necessary if we have a CompositeErrorReporter
                ErrorReport.NotifyUserOfProblem(policy, error, message, args);
            }
            finally
            {
                System.Threading.Monitor.Exit(_lock);
            }
        }
コード例 #24
0
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     if (policy.ShouldShowErrorReportDialog(exception))
         ErrorReporter.ReportException(exception, m_registryKey, m_supportEmailAddress, m_parentForm, false);
 }
コード例 #25
0
        public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label,
			ErrorResult resultIfAlternateButtonPressed, string message)
        {
            return policy.ShouldShowMessage(message) &&
                ErrorReporter.ReportException(new Exception(message), m_registryKey, m_supportEmailAddress, m_parentForm, false) ?
                ErrorResult.Abort : ErrorResult.Ignore;
        }
コード例 #26
0
 public void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
 {
     NonFatalProblem.ReportSentryOnly(exception);
 }
コード例 #27
0
 public ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string alternateButton1Label,
                                        ErrorResult resultIfAlternateButtonPressed, string message)
 {
     NonFatalProblem.ReportSentryOnly(message);
     return(ErrorResult.OK);
 }
コード例 #28
0
 public void NotifyUserOfProblem(IRepeatNoticePolicy policy, Exception error, string message)
 {
     NonFatalProblem.ReportSentryOnly(error, message);
 }
コード例 #29
0
 /// <summary>
 /// Adapter around 4-argument overload of ErrorReport.NotifyUserOfProblem (Auto-invoke version)
 /// This adapter exposes two additional parameters to control the secondary action button
 ///
 /// Uses the default Report button (aka Details button or alternateButton1)
 /// The corresponding action will be automatically invoked by ErrorReport.cs after each button is clicked.
 /// </summary>
 /// <param name="secondaryActionLabel">Optional - The localized text of the secondary action button. Pass null or "" to disable this button.</param>
 /// <param name="onSecondaryPressed">Optional - The action to execute after the secondary action button is pressed. If the secondary action is disabled, it is safe to pass null here. But if it is enabled and you actually want nothing to happen, you should pass in an Action that does nothing, not pass null</param>
 /// <param name="error">Optional - The error to report. Or you may rely on {messageFmt}</param>
 /// <param name="messageFmt">Optional - The message to report to the user. May be a format string. Or, you may rely on {error} instead.</param>
 /// <param name="args">The format string arguments</param>
 public static void NotifyUserOfProblem(string secondaryActionLabel, Action <Exception, string> onSecondaryPressed,
                                        IRepeatNoticePolicy policy, Exception error, string messageFmt, params object[] args)
 {
     HtmlErrorReporter.Instance.CustomNotifyUserAuto(null, secondaryActionLabel, onSecondaryPressed, policy, error, messageFmt, args);
 }
コード例 #30
0
ファイル: ErrorReport.cs プロジェクト: regnrand/libpalaso
		public static ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string messageFmt, params object[] args)
		{
			return NotifyUserOfProblem(policy, null, default(ErrorResult), messageFmt, args);
		}
コード例 #31
0
ファイル: ErrorReport.cs プロジェクト: regnrand/libpalaso
		public static void NotifyUserOfProblem(IRepeatNoticePolicy policy, Exception error, string messageFmt, params object[] args)
		{
			var result = NotifyUserOfProblem(policy, "Details", ErrorResult.Yes, messageFmt, args);
			if (result == ErrorResult.Yes)
			{
				ErrorReport.ReportNonFatalExceptionWithMessage(error, string.Format(messageFmt, args));
			}

			UsageReporter.ReportException(false, null, error, String.Format(messageFmt, args));
		}
コード例 #32
0
ファイル: ErrorReport.cs プロジェクト: regnrand/libpalaso
		public static ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy,
									string alternateButton1Label,
									ErrorResult resultIfAlternateButtonPressed,
									string messageFmt,
									params object[] args)
		{
			var message = string.Format(messageFmt, args);
			if (s_justRecordNonFatalMessagesForTesting)
			{
				s_previousNonFatalMessage = message;
				return ErrorResult.OK;
			}
			return _errorReporter.NotifyUserOfProblem(policy, alternateButton1Label, resultIfAlternateButtonPressed, message);
		}
コード例 #33
0
 /// <summary>
 /// Wrapper around 3-argument overload (with policy) of ErrorReport.NotifyUserOfProblem
 /// This wrapper is identical to calling ErrorReport directly.
 ///
 /// Other than OK, no other buttons will be shown.
 /// </summary>
 public static ErrorResult NotifyUserOfProblem(IRepeatNoticePolicy policy, string messageFmt, params object[] args)
 {
     return(ErrorReport.NotifyUserOfProblem(policy, messageFmt, args));
 }
コード例 #34
0
ファイル: ErrorReport.cs プロジェクト: regnrand/libpalaso
		/// <summary>
		/// Allow user to report an exception even though the program doesn't need to exit
		/// </summary>
		public static void ReportNonFatalException(Exception exception, IRepeatNoticePolicy policy)
		{
			if (s_justRecordNonFatalMessagesForTesting)
			{
				ErrorReport.s_previousNonFatalException = exception;
				return;
			}
			_errorReporter.ReportNonFatalException(exception, policy);
			UsageReporter.ReportException(false, null, exception, null);
		}