private void OnDraw(object sender, DrawEventArgs e) { try { if (!_exception) { _game.Tick(e.DeltaTime, e.TotalTime); e.InvalidateSurface(); } } catch (Exception ex) { if (!_exception) { _exception = true; Dispatcher.BeginInvoke(() => { throw new EngineException(ex); }); } } }