コード例 #1
0
        private CmsObservableCollection<Area> FilterAreas()
        {
            IEnumerable<Area> filteredAreas = new CmsObservableCollection<Area>(mAreas);

            //Keyword
            string keyword = Keyword;
            if (!string.IsNullOrEmpty(keyword))
            {
                string[] textArray = keyword.Split(' ');

                //Add custom entered search text filters
                foreach (var searchText in textArray)
                {
                    if (!string.IsNullOrEmpty(searchText))
                    {
                        string text = searchText.ToLower();
                        filteredAreas = filteredAreas.Where(
                            x => x.Name.ToLower().Contains(text) ||
                            x.Description.ToLower().Contains(text));
                    }
                }
            }

            return new CmsObservableCollection<Area>(filteredAreas);
        }
コード例 #2
0
        private CmsObservableCollection<Prompt> FilterPrompts()
        {
            IEnumerable<Prompt> filteredPrompts = new CmsObservableCollection<Prompt>(mPrompts);

            if (PromptGroup != null && PromptGroup.Name != "All")
            {
                filteredPrompts = filteredPrompts.Where(
                    x => x.PromptGroupId == PromptGroup.Id);
            }

            return new CmsObservableCollection<Prompt>(filteredPrompts);
        }