public static async void Iterate <T>(IPixivAsyncEnumerable <T> pixivIterator, ICollection <T> container, int limit = -1) { var hashTable = new Dictionary <string, Illustration>(); IteratingSchedule.StartNewInstance(pixivIterator); await foreach (T illust in IteratingSchedule.CurrentItr) { if (IteratingSchedule.CurrentItr.IsCancellationRequested() || limit != -1 && pixivIterator.RequestedPages > limit) { break; } if (illust is Illustration i) { if (IllustNotMatchCondition(Settings.Global.ExceptTags, Settings.Global.ContainsTags, i)) { continue; } if (container is Collection <Illustration> illustrationContainer) { if (hashTable.ContainsKey(i.Id)) { continue; } hashTable[i.Id] = i; IComparer <Illustration> comparer = IteratingSchedule.CurrentItr.SortOption switch { SortOption.None => null, SortOption.PublishDate => IllustrationPublishDateComparator.Instance, SortOption.Popularity => IllustrationPopularityComparator.Instance, _ => null }; illustrationContainer.AddSorted(i, comparer); } } else { if (illust != null) { container.Add(illust); } } } }
private void NavigatorList_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { TrendingTagPopup.CloseControl(); if (NavigatorList.SelectedItem is ListViewItem current) { var translateTransform = (TranslateTransform)HomeDisplayContainer.RenderTransform; if (current == MenuTab && !translateTransform.Y.Equals(0)) { ReleaseItemsSource(SpotlightListView); ReleaseItemsSource(ImageListView); ReleaseItemsSource(UserPreviewListView); IteratingSchedule.CancelCurrent(); HomeContainerMoveUp(); } else if (current != MenuTab && translateTransform.Y.Equals(0)) { HomeContainerMoveDown(); } } }