Пример #1
0
 /// <summary>
 /// Returns an enumerator that iterates through the channels collection.
 /// </summary>
 /// <returns>An enumerator that can be used to iterate through the channels collection.</returns>
 protected virtual IEnumerator <IRealtimeChannel> GetEnumerator()
 {
     lock (_orderedChannels)
     {
         return(_orderedChannels.ToList().GetEnumerator());
     }
 }
        private async void TabSelectChanged(TreeViewModelBase viewModel, string propertyName, ListSortDirection direction)
        {
            if (viewModel is SearchViewModel searchViewModel)
            {
                IEnumerable <SearchListViewItemInfo> searchItems = null;
                {
                    var tempViewModels = new List <SearchViewModel>();
                    tempViewModels.AddRange(searchViewModel.GetAncestors().OfType <SearchViewModel>());

                    await Task.Run(() =>
                    {
                        searchItems = _cache_SearchItems.ToList();

                        foreach (var tempViewModel in tempViewModels)
                        {
                            searchItems = Filter(searchItems, tempViewModel.Model);
                        }

                        searchItems = this.Sort(searchItems, propertyName, direction, 100000);
                    });
                }

                if (this.TabSelectedItem.Value != viewModel)
                {
                    return;
                }

                searchViewModel.Model.IsUpdated = false;

                _contents.Clear();
                _contents.AddRange(searchItems);

                searchViewModel.Count.Value = _contents.Count;
            }
        }