/// <summary> /// OpenWF Composition error checking. /// </summary> public static void CheckErrors(WFCErrorCode errorCode) { if (errorCode != WFCErrorCode.ErrorNone) { throw new InvalidOperationException(String.Format("OpenWF error: {0}", errorCode)); } }
/// <summary> /// Releases all resource used by the <see cref="WfcDevice"/> object. /// </summary> /// <param name="disposing"> /// A <see cref="Boolean"/> indicating whether the disposition happens in a managed context. /// </param> private void Dispose(bool disposing) { if (_Disposed) { return; } if (_Handle != Wfc.INVALID_HANDLE) { WFCErrorCode err = Wfc.DestroyDevice(_Handle); _Handle = Wfc.INVALID_HANDLE; // Throw exception is disposition is managed if (disposing) { Wfc.CheckErrors(err); } } _Disposed = true; }