private void Action_HandleException(object sender, HandleExceptionEventArgs e)
 {
     if (!e.Handled)
     {
         ((ConsoleApplication)((SimpleAction)sender).Controller.Application).HandleException(e.Exception);
         e.Handled = true;
     }
 }
        public void TestAtIsHandledSetterOpdatererValue(bool value)
        {
            var fixture = new Fixture();

            var eventArgs = new HandleExceptionEventArgs(fixture.Create <IntranetGuiSystemException>());

            Assert.That(eventArgs, Is.Not.Null);

            eventArgs.IsHandled = value;
            Assert.That(eventArgs.IsHandled, Is.EqualTo(value));
        }
        public void TestAtConstructorInitiererHandleExceptionEventArgs()
        {
            var fixture = new Fixture();

            var error     = fixture.Create <IntranetGuiSystemException>();
            var eventArgs = new HandleExceptionEventArgs(error);

            Assert.That(eventArgs, Is.Not.Null);
            Assert.That(eventArgs.Error, Is.Not.Null);
            Assert.That(eventArgs.Error, Is.EqualTo(error));
            Assert.That(eventArgs.IsHandled, Is.False);
        }
示例#4
0
        public void TestThatConstructorInitializeHandleExceptionEventArgsWithoutExceptionObjectAndExceptionObjectData()
        {
            var fixture   = new Fixture();
            var exception = fixture.CreateAnonymous <Exception>();
            var eventArgs = new HandleExceptionEventArgs(exception);

            Assert.That(eventArgs, Is.Not.Null);
            Assert.That(eventArgs.Message, Is.Not.Null);
            Assert.That(eventArgs.Message, Is.Not.Empty);
            Assert.That(eventArgs.Message, Is.EqualTo(exception.Message));
            Assert.That(eventArgs.Exception, Is.Not.Null);
            Assert.That(eventArgs.Exception, Is.EqualTo(exception));
            Assert.That(eventArgs.ExceptionObject, Is.Null);
            Assert.That(eventArgs.ExceptionObjectData, Is.Null);
            Assert.That(eventArgs.CanContinue, Is.False);
        }
示例#5
0
        /// <summary>
        /// Publiserer og håndterer en exception.
        /// </summary>
        /// <param name="exception">Exception, der skal håndteres.</param>
        private void PulishException(Exception exception)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }
            if (OnHandleException == null)
            {
                _exceptions.Add(new ExceptionViewModel(exception));
                return;
            }
            var eventArgs = new HandleExceptionEventArgs(exception)
            {
                IsHandled = false
            };

            OnHandleException.Invoke(this, eventArgs);
            if (!eventArgs.IsHandled)
            {
                _exceptions.Add(new ExceptionViewModel(exception));
            }
        }
示例#6
0
        } // HandleException

        internal static void HandleException(object sender, HandleExceptionEventArgs e)
        {
            HandleException(e.OwnerForm, e.Caption, e.Message, e.Exception);
        } // HandleException
示例#7
0
        } // OnAfterAssignNumbers

        protected void OnHandleException(object sender, HandleExceptionEventArgs e)
        {
            Exception?.Invoke(sender, e);
        } // OnHandleException
 void ActionOnHandleException(object sender, HandleExceptionEventArgs handleExceptionEventArgs)
 {
     ScrollWindowToTop();
 }