private void WaitForPendingWork() { var working = WorkStopwatch.IsRunning; if (working) { WorkStopwatch.Stop(); } WaitStopwatch.Start(); try { _DrawThread.WaitForPendingWork(); } catch (DeviceLostException) { _DeviceLost = true; } catch (ObjectDisposedException) { if (Device.IsDisposed) { _Running = false; } else { throw; } } WaitStopwatch.Stop(); if (working) { WorkStopwatch.Start(); } }
private void WaitForPendingWork() { if (IsDisposed) { return; } var working = WorkStopwatch.IsRunning; if (working) { WorkStopwatch.Stop(); } WaitStopwatch.Start(); try { DrawQueue.WaitUntilDrained(); } catch (DeviceLostException) { _DeviceLost = true; } catch (ObjectDisposedException) { if (Device.IsDisposed) { _Running = false; } else { throw; } } WaitStopwatch.Stop(); if (working) { WorkStopwatch.Start(); } }