Beispiel #1
0
 /// <summary>
 /// Handles exceptions at the rendering subsystem.
 /// </summary>
 /// <param name="sender">The event source.</param>
 /// <param name="e">The event arguments.</param>
 public void HandleRenderException(object sender, RelayExceptionEventArgs e)
 {
     if (e.Exception != null)
     {
         MessageBox.Show(e.Exception.ToString(), "RenderException");
     }
 }
Beispiel #2
0
        /// <summary>
        /// Invoked whenever an exception occurs. Stops rendering, frees resources and throws 
        /// </summary>
        /// <param name="exception">The exception that occured.</param>
        /// <returns><c>true</c> if the exception has been handled, <c>false</c> otherwise.</returns>
        private bool HandleExceptionOccured(Exception exception)
        {
            pendingValidationCycles = 0;
            StopRendering();
            EndD3D();

            var args = new RelayExceptionEventArgs(exception);
            ExceptionOccurred(this, args);
            return args.Handled;
        }
Beispiel #3
0
        /// <summary>
        /// Handles a rendering exception.
        /// </summary>
        /// <param name="sender">The event source.</param>
        /// <param name="e">The event arguments.</param>
        private void HandleRenderException(object sender, RelayExceptionEventArgs e)
        {
            var bindingExpression = this.GetBindingExpression(RenderExceptionProperty);
            if (bindingExpression != null)
            {
                // If RenderExceptionProperty is bound, we assume the exception will be handled.
                this.RenderException = e.Exception;
                e.Handled = true;
            }

            // Fire RenderExceptionOccurred event
            this.RenderExceptionOccurred(sender, e);

            // If the Exception is still unhandled...
            if (!e.Handled)
            {
                // ... prevent a MessageBox.Show().
                this.MessageText = e.Exception.ToString();
                e.Handled = true;
            }
        }