コード例 #1
0
        private void UpdateBindedCollection()
        {
            if (ShowCategory == CategoryEnum.All)
            {
                if (Device.RuntimePlatform == Device.Android)
                {
                    FilteredCollection.Clear();
                }
                else
                {
                    FilteredCollection = new ObservableCollection <JokeItem>();
                }

                foreach (var item in JokeList)
                {
                    FilteredCollection.Add(item);
                }
            }
            else
            {
                if (Device.RuntimePlatform == Device.Android)
                {
                    FilteredCollection.Clear();
                }
                else
                {
                    FilteredCollection = new ObservableCollection <JokeItem>();
                }

                foreach (var item in JokeList.Where(joke => joke.Category == ShowCategory))
                {
                    FilteredCollection.Add(item);
                }
            }
        }
コード例 #2
0
        private void FilterItems()
        {
            IEnumerable source = ItemsSource;

            if (source == null)
            {
                FilteredItems.Clear();
                return;
            }

            IEnumerator enumerator = source.GetEnumerator();

            if (!enumerator.MoveNext())
            {
                FilteredItems.Clear();
                return;
            }

            FilterPredicate    predicate = Predicate;
            FilteredCollection filtered  = new FilteredCollection();

            do
            {
                object item = enumerator.Current;
                if (predicate == null || predicate.Matches(item))
                {
                    filtered.Add(item);
                }
            }while (enumerator.MoveNext());

            FilteredItems = filtered;
        }
コード例 #3
0
        public void FilterCollection()
        {
            if (FilterValue == null || FilterValue.Equals(default(TInner)))
            {
                FilteredCollection.Clear();
                return;
            }

            foreach (var item in UnfilteredCollection)
            {
                if (PassFilterDelegate(item, FilterValue))
                {
                    if (!FilteredCollection.Contains(item))
                    {
                        FilteredCollection.Add(item);
                    }
                }
                else
                {
                    if (FilteredCollection.Contains(item))
                    {
                        FilteredCollection.Remove(item);
                    }
                }
            }
        }
コード例 #4
0
        public static void UpdateCollection(string search)
        {
            ObservableCollection <Service> hold = new ObservableCollection <Service>();

            hold = ServiceCollection;
            if (!string.IsNullOrEmpty(search))
            {
                ServiceCollection.Clear();
                IEnumerable <Service> serviceQuery = Services.Where(x => (x.Service_Name.ToLower()).Contains(search));
                foreach (Service service in serviceQuery)
                {
                    FilteredCollection.Add(service);
                }
                ServiceCollection = FilteredCollection;
                CollectionViewSource.GetDefaultView(ServiceCollection).Refresh();
            }
            else
            {
                ServiceCollection  = hold;
                FilteredCollection = ServiceCollection;
                CollectionViewSource.GetDefaultView(ServiceCollection).Refresh();
            }


            //ServiceCollection = Services;

            /*
             * Pet petToUpdate = PetCollection.FirstOrDefault(x => x.Name == pet.Name);
             * petToUpdate.Stock = petToUpdate.Stock - purchasedAmount;
             * CollectionViewSource.GetDefaultView(PetCollection).Refresh();*/
        }
コード例 #5
0
        public IEnumerable <IEmergingPattern> Mine(InstanceModel model, IEnumerable <Instance> instances, Feature classFeature)
        {
            EmergingPatternCreator                EpCreator  = new EmergingPatternCreator();
            EmergingPatternComparer               epComparer = new EmergingPatternComparer(new ItemComparer());
            IEmergingPatternSimplifier            simplifier = new EmergingPatternSimplifier(new ItemComparer());
            FilteredCollection <IEmergingPattern> minimal    =
                new FilteredCollection <IEmergingPattern>(epComparer.Compare, FilterRelation);

            if (MinePatternsWhileBuildingTree)
            {
                DecisionTreeBuilder.OnSplitEvaluation =
                    delegate(IDecisionTreeNode node, ISplitIterator iterator, List <SelectorContext> currentContext)
                {
                    IChildSelector currentSelector = null;
                    for (int i = 0; i < iterator.CurrentDistribution.Length; i++)
                    {
                        double[] distribution = iterator.CurrentDistribution[i];
                        if (EPTester.Test(distribution, model, classFeature))
                        {
                            if (currentSelector == null)
                            {
                                currentSelector = iterator.CreateCurrentChildSelector();
                            }
                            EmergingPattern ep = EpCreator.ExtractPattern(currentContext, model, classFeature,
                                                                          currentSelector, i);
                            ep.Counts = (double[])distribution.Clone();
                            minimal.Add(simplifier.Simplify(ep));
                        }
                    }
                };
                DoMine(model, instances, classFeature, EpCreator, null);
            }
            else
            {
                DoMine(model, instances, classFeature, EpCreator, p =>
                {
                    if (EPTester.Test(p.Counts, model, classFeature))
                    {
                        minimal.Add(simplifier.Simplify(p));
                    }
                }
                       );
            }
            return(minimal.GetItems());
        }
コード例 #6
0
 public void FilterVeggies()
 {
     filter.FilterVeggies();
     if (FilteredCollection != null)
     {
         FilteredCollection.Clear();
     }
     foreach (var item in filter.productCatalogFilters)
     {
         FilteredCollection.Add(item);
     }
 }
コード例 #7
0
        /// <summary>
        /// method for filterCommand
        /// </summary>
        public void FilterExecute()
        {
            FilteredCollection.Clear();

            switch (SelectedFilterItem)
            {
            case "System.Windows.Controls.ComboBoxItem: Titel":
                foreach (ViewComic viewComic in _comicList)
                {
                    if (viewComic.Title.Trim().Contains(FilterQuery.Trim()))
                    {
                        FilteredCollection.Add(new GridRow(viewComic));
                    }
                }
                break;

            case "System.Windows.Controls.ComboBoxItem: Reeks":
                foreach (ViewComic viewComic in _comicList)
                {
                    if (viewComic.Series.Name.Trim().Contains(FilterQuery.Trim()))
                    {
                        FilteredCollection.Add(new GridRow(viewComic));
                    }
                }
                break;

            case "System.Windows.Controls.ComboBoxItem: Auteur":
                foreach (ViewComic viewComic in _comicList)
                {
                    foreach (ViewAuthor author in viewComic.Authors)
                    {
                        if (author.Name.Trim().Contains(FilterQuery.Trim()))
                        {
                            FilteredCollection.Add(new GridRow(viewComic));
                        }
                    }
                }
                break;

            case "System.Windows.Controls.ComboBoxItem: Uitgeverij":
                foreach (ViewComic viewComic in _comicList)
                {
                    if (viewComic.Publisher.Name.Trim().Contains(FilterQuery.Trim()))
                    {
                        FilteredCollection.Add(new GridRow(viewComic));
                    }
                }
                break;

            default:
                break;
            }
        }
コード例 #8
0
        private void RepopulateFilteredCollection()
        {
            List <BoardGameDataItem> filtered = new List <BoardGameDataItem>();

            foreach (BoardGameDataItem ci in Collection)
            {
                bool ShowMe = true;
                if (CurrentPlayerFilter != null)
                {
                    ShowMe = CurrentPlayerFilter.Matches(ci);
                }

                if (ShowMe && CurrentPlayTimeFilter != null)
                {
                    ShowMe = CurrentPlayTimeFilter.Matches(ci);
                }

                if (ShowMe && CurrentStatusFilter != null)
                {
                    ShowMe = CurrentStatusFilter.Matches(ci);
                }

                if (ShowMe && CurrentExpansionFilter != null)
                {
                    ShowMe = CurrentExpansionFilter.Matches(ci);
                }

                if (ShowMe && CurrentTextFilter != null)
                {
                    ShowMe = CurrentTextFilter.Matches(ci);
                }

                if (ShowMe)
                {
                    filtered.Add(ci);
                }
            }

            IOrderedEnumerable <BoardGameDataItem> sortedList = CurrentCollectionSorter.Sort(filtered);

            FilteredCollection.Clear();
            foreach (BoardGameDataItem item in sortedList)
            {
                FilteredCollection.Add(item);
            }

            RaisePropertyChanged("NumberItemsDisplayed");
        }