/// <summary> /// Creates a new <see cref="RemovableDriveWatcher"/>. /// </summary> /// <returns> /// A new instance of the <see cref="RemovableDriveWatcher"/> class, /// if none has been created yet; otherwise, the singleton instance. /// </returns> public static RemovableDriveWatcher Create() { if (instance == null) { instance = new RemovableDriveWatcher(); instance.StartInsertWatcher(); instance.StartRemoveWatcher(); } return(instance); }
/// <summary> /// Creates a new <see cref="RemovableDriveWatcher"/>. /// </summary> /// <returns> /// A new instance of the <see cref="RemovableDriveWatcher"/> class, /// if none has been created yet; otherwise, the singleton instance. /// </returns> public static RemovableDriveWatcher Create() { if (instance == null) { instance = new RemovableDriveWatcher(); instance.StartInsertWatcher(); instance.StartRemoveWatcher(); } return instance; }
/// <summary> /// Initializes a new instance of the <see cref="Library"/> class. /// </summary> public Library() { this.songLock = new object(); this.songs = new HashSet<Song>(); this.playlist = new Playlist(); this.volume = 1.0f; this.AccessMode = AccessMode.Administrator; // We want implicit to be the administrator, till we change to user mode manually this.driveWatcher = RemovableDriveWatcher.Create(); this.driveWatcher.DriveRemoved += (sender, args) => Task.Factory.StartNew(this.Update); this.cacheResetHandle = new AutoResetEvent(false); this.disposeLock = new object(); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { instance.insertWatcher.Dispose(); instance.removeWatcher.Dispose(); instance = null; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { instance.insertWatcher.Dispose(); instance.removeWatcher.Dispose(); instance = null; }