Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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;
        }
Ejemplo n.º 3
0
 /// <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();
 }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
 /// <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;
 }