Exemple #1
0
        } // HandleException

        private void HandleOwnedFormException(ExceptionEventData ex)
        {
            if (!HandleMyOwnExceptions)
            {
                var parent = ParentForm as CommonBaseForm;
                if (parent != null)
                {
                    parent.GetExceptionHandler().Invoke(ex);
                } // if
            }     // if

            ExceptionHandler(ex);
        } // HandleOwnedFormException
Exemple #2
0
        } // HandleException

        private void HandleOwnedFormException(CommonBaseForm form, ExceptionEventData ex)
        {
            if (!HandleOwnedFormsExceptions)
            {
                var parent = form.ParentForm as CommonBaseForm;
                if (parent != null)
                {
                    parent.HandleOwnedFormException(this, ex);
                } // if
            }     // if

            ExceptionHandler(form, ex);
        } // HandleOwnedFormException
Exemple #3
0
        } // HandleOwnedFormException

        /// <summary>
        /// Exception handler.
        /// By default displays an ExceptionMessageBox. Descendants are encouraged to provide their own implementation.
        /// </summary>
        /// <param name="ex">The data about the exception, including additional information for the user, such a caption or a text</param>
        /// <remarks>Descendants who override this method MUST NOT call base.ExceptionHandler.
        /// This method MUST NOT be called directly. To handle and exception, HandleException MUST be used instead.
        /// </remarks>
        protected virtual void ExceptionHandler(ExceptionEventData ex)
        {
            BasicGoogleTelemetry.SendExtendedExceptionHit(ex.Exception, true, ex.Message, this.GetType().Name);

            var box = new ExceptionMessageBox()
            {
                Caption = Properties.CommonForm.UncaughtExceptionCaption,
                Buttons = ExceptionMessageBoxButtons.OK,
                Symbol  = ExceptionMessageBoxSymbol.Stop,
            };

            if (ex.Message == null)
            {
                box.Text    = ex.Exception.Message;
                box.Message = ex.Exception;
            }
            else
            {
                box.Text           = ex.Message;
                box.InnerException = ex.Exception;
            } // if-else

            box.Show(ParentForm);
        } // ExceptionHandler
Exemple #4
0
        } // HandleMyOwnExceptions

        /// <summary>
        /// Provides an unified way of handling exceptions.
        /// </summary>
        /// <param name="ex">The data about the exception, including additional information for the user, such a caption or a text</param>
        /// <remarks>If a parent CommonForm exists, the exception will be passed along.
        /// If no parent is found, the virtual method ExceptionHandler will be called</remarks>
        protected void HandleException(ExceptionEventData ex)
        {
            HandleOwnedFormException(ex);
        } // HandleException
Exemple #5
0
        } // HandleException

        internal static void HandleException(Form form, ExceptionEventData ex)
        {
            MyApplication.HandleException(form, ex.Caption, ex.Message, ex.Exception);
        } // HandleException
Exemple #6
0
 protected override void ExceptionHandler(CommonBaseForm form, ExceptionEventData ex)
 {
     MyApplication.HandleException(form, ex);
 } // ExceptionHandler