Beispiel #1
0
 protected virtual async Task AddLibraryItems(IEnumerable <string> paths, CancellationToken cancellationToken)
 {
     using (var transaction = this.Database.BeginTransaction(this.Database.PreferredIsolationLevel))
     {
         using (var libraryPopulator = new LibraryPopulator(this.Database, this.PlaybackManager, this.Visible, transaction))
         {
             libraryPopulator.InitializeComponent(this.Core);
             await this.WithSubTask(libraryPopulator,
                                    () => libraryPopulator.Populate(paths, cancellationToken)
                                    ).ConfigureAwait(false);
         }
         transaction.Commit();
     }
 }
Beispiel #2
0
 protected virtual async Task AddLibraryItems(IEnumerable <string> paths, CancellationToken cancellationToken)
 {
     //We don't know how many files we're about to enumerate.
     if (!this.IsIndeterminate)
     {
         await this.SetIsIndeterminate(true).ConfigureAwait(false);
     }
     using (var transaction = this.Database.BeginTransaction(this.Database.PreferredIsolationLevel))
     {
         using (var libraryPopulator = new LibraryPopulator(this.Database, this.PlaybackManager, this.Visible, transaction))
         {
             libraryPopulator.InitializeComponent(this.Core);
             await this.WithSubTask(libraryPopulator,
                                    async() => await libraryPopulator.Populate(paths, cancellationToken)
                                    .ConfigureAwait(false)).ConfigureAwait(false);
         }
         transaction.Commit();
     }
 }