/// <summary> /// Releases all resource used by the <see cref="CyrusBuilt.MonoPi.Devices.PiCamera.PiCameraDevice"/> object. /// </summary> /// <remarks>Call <see cref="Dispose"/> when you are finished using the /// <see cref="CyrusBuilt.MonoPi.Devices.PiCamera.PiCameraDevice"/>. The <see cref="Dispose"/> method leaves the /// <see cref="CyrusBuilt.MonoPi.Devices.PiCamera.PiCameraDevice"/> in an unusable state. After calling /// <see cref="Dispose"/>, you must release all references to the /// <see cref="CyrusBuilt.MonoPi.Devices.PiCamera.PiCameraDevice"/> so the garbage collector can reclaim the memory /// that the <see cref="CyrusBuilt.MonoPi.Devices.PiCamera.PiCameraDevice"/> was occupying.</remarks> public void Dispose() { if (this._isDisposed) { return; } if (this._captureProc != null) { if (!this._captureProc.HasExited) { try { this._captureProc.Kill(); } catch { } } } lock (_syncLock) { this._isRunning = false; } if (this._captureMonitor != null) { if (this._captureMonitor.IsAlive) { try { Thread.Sleep(50); this._captureMonitor.Abort(); } catch (ThreadAbortException) { Thread.ResetAbort(); } } this._captureMonitor = null; } this._pid = -1; this._settings = null; this._isDisposed = true; GC.SuppressFinalize(this); }
/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Devices.PiCamera.PiCameraDevice"/> /// class with the image capture settings. /// </summary> /// <param name="settings"> /// The image capture settings to use. /// </param> public PiCameraDevice(StillCaptureSettings settings) { this._settings = settings; }