/// <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"); } }
/// <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) { this.pendingValidationCycles = 0; this.StopRendering(); this.EndD3D(); var args = new RelayExceptionEventArgs(exception); this.ExceptionOccurred(this, args); return(args.Handled); }
/// <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) { EndD3D(); var sdxException = exception as SharpDXException; if (sdxException != null && (sdxException.Descriptor == global::SharpDX.DXGI.ResultCode.DeviceRemoved || sdxException.Descriptor == global::SharpDX.DXGI.ResultCode.DeviceReset)) { // Try to recover from DeviceRemoved/DeviceReset StartD3D(); return(true); } else { var args = new RelayExceptionEventArgs(exception); ExceptionOccurred(this, args); return(args.Handled); } }
/// <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; } }
/// <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 = false; StopRendering(); EndD3D(true); var sdxException = exception as SharpDXException; if (sdxException != null && (sdxException.Descriptor == global::SharpDX.DXGI.ResultCode.DeviceRemoved || sdxException.Descriptor == global::SharpDX.DXGI.ResultCode.DeviceReset)) { return(true); } else { var args = new RelayExceptionEventArgs(exception); ExceptionOccurred(this, args); return(args.Handled); } }
private void RenderHostInternal_ExceptionOccurred(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?.Invoke(sender, e); // If the Exception is still unhandled... if (!e.Handled) { // ... prevent a MessageBox.Show(). this.MessageText = e.Exception.ToString(); e.Handled = true; } hostPresenter.Content = null; Disposer.RemoveAndDispose(ref renderHostInternal); }
/// <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; }