public StatisticsWindow(ICollectionSessionFactory collectionSessionFactory) : base(collectionSessionFactory) { InitializeComponent(); this.generator = new CollectionStatisticsGenerator(this.CollectionManager); this.generator.ProgressChanged += ProgressBarUpdater.CreateHandler(this.Dispatcher, this.busyIndicator, () => this.shouldCancel); }
private void ScannerTask() { LocalCollectionMatcher matcher = new LocalCollectionMatcher(this.CollectionManager); matcher.CollectionScannerProgressChanged += ProgressBarUpdater.CreateHandler(this.Dispatcher, this.progressScan, () => this.cancelScanning, p => { this.labelScanStatus.Text = p == 1 ? "" : "Reading file tags..."; }); matcher.ProgressChanged += ProgressBarUpdater.CreateHandler(this.Dispatcher, this.progressMatch, () => this.cancelScanning, p => { this.labelMatchStatus.Text = p == 1 ? "" : "Matching with database contents..."; }); this.matcherResult = matcher.Match(); if (this.cancelScanning) { return; } List <CollectionChangeItem> changedItems = new List <CollectionChangeItem>(); changedItems.AddRange(this.matcherResult.NewReleases.Select(r => new CollectionChangeItem() { Type = CollectionChangeType.Addded, LocalAlbum = r })); changedItems.AddRange(this.matcherResult.ChangedReleases.Select(r => new CollectionChangeItem() { Type = CollectionChangeType.Changed, Release = r.Item1, LocalAlbum = r.Item2 })); changedItems.AddRange(this.matcherResult.DeletedReleases.Select(r => new CollectionChangeItem() { Type = CollectionChangeType.Deleted, Release = r })); changedItems.Sort((a, b) => a.ReleaseDisplayName.CompareTo(b.ReleaseDisplayName)); List <CollectionChangeItem> unchangedItems = new List <CollectionChangeItem>(); unchangedItems.AddRange(this.matcherResult.UnchangedReleases.Select(r => new CollectionChangeItem() { Type = CollectionChangeType.Deleted, Release = r })); this.Dispatcher.BeginInvoke(new Action(() => { this.OnScanningCompleted(changedItems, unchangedItems); })); }
private void MergerTask(object saveToFiles) { LocalCollectionMerger merger = new LocalCollectionMerger( this.CollectionManager, this.matcherResult, (bool)saveToFiles); merger.ProgressChanged += ProgressBarUpdater.CreateHandler(this.Dispatcher, this.progressMerge); merger.Merge(); this.Dispatcher.Invoke(new Action(() => { CollectionManagerGlobal.OnCollectionChanged(); EnableCloseButton(); })); }