/// <summary> /// Release all resources used by <see cref="ShellWatcher" /> class. /// and optionally releases managed resources. /// </summary> /// <param name="disposing"> /// <c>true</c> to release both managed and unmanaged resources. /// <c>false</c> to release only unmanaged resources. /// </param> protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { // Release managed resources. ShellWatcherManager.UnregisterAsync(this).Wait(); } this.disposed = true; } }
/// <summary> /// Create the <see cref="ShellWatcher" />. /// </summary> /// <param name="shellObject">Monitoring to <see cref="ShellObject" />.</param> /// <param name="recursive">Flag indicating whether to monitor recursively.</param> /// <returns></returns> public static async Task <ShellWatcher> CreateAsync(ShellObject shellObject, bool recursive) { Contract.Requires <ArgumentNullException>(shellObject != null); return(await ShellWatcherManager.RegisterAsync(shellObject, recursive)); }