private void StopDesktopDuplicator() { device?.Dispose(); stagingTexture?.Dispose(); smallerTexture?.Dispose(); smallerTextureView?.Dispose(); duplication.Dispose(); }
private void Dispose(bool disposing) { if (!IsDisposed) { if (disposing) { if (!_desktopImageTexture.IsDisposed) { _desktopImageTexture.Dispose(); } if (_outputDuplication != null && !_outputDuplication.IsDisposed) { try { _outputDuplication.ReleaseFrame(); } catch { // Do Nothing... } _outputDuplication.Dispose(); } if (_immediateContext != null && !_immediateContext.IsDisposed) { _immediateContext.Dispose(); } if (_d3dDevice != null && !_d3dDevice.IsDisposed) { _d3dDevice.Dispose(); } } IsDisposed = true; } }