示例#1
0
 protected virtual async Task AddOrUpdateMetaData(CancellationToken cancellationToken)
 {
     using (var transaction = this.Database.BeginTransaction(this.Database.PreferredIsolationLevel))
     {
         using (var metaDataPopulator = new PlaylistMetaDataPopulator(this.Database, this.Visible, transaction))
         {
             metaDataPopulator.InitializeComponent(this.Core);
             await this.WithSubTask(metaDataPopulator,
                                    async() => await metaDataPopulator.Populate(PlaylistItemStatus.Import, cancellationToken)
                                    .ConfigureAwait(false)).ConfigureAwait(false);
         }
         transaction.Commit();
     }
 }
示例#2
0
        protected virtual async Task AddOrUpdateMetaData(CancellationToken cancellationToken)
        {
            using (var transaction = this.Database.BeginTransaction(this.Database.PreferredIsolationLevel))
            {
                using (var metaDataPopulator = new PlaylistMetaDataPopulator(this.Database, this.Visible, transaction))
                {
                    metaDataPopulator.InitializeComponent(this.Core);
                    await this.WithSubTask(metaDataPopulator,
                                           () => metaDataPopulator.Populate(PlaylistItemStatus.Import, cancellationToken)
                                           ).ConfigureAwait(false);

                    foreach (var pair in metaDataPopulator.Warnings)
                    {
                        if (pair.Key is PlaylistItem playlistItem)
                        {
                            this.Warnings.GetOrAdd(playlistItem, _playlistItem => new List <string>()).AddRange(pair.Value);
                        }
                    }
                }
                transaction.Commit();
            }
        }