Exemplo n.º 1
0
        private List <SearchFilterModel> MapSearchFilter(NavigationContainer navigation)
        {
            List <SearchFilterModel> result = new List <SearchFilterModel>();

            if (navigation != null && navigation.NavigationItems != null)
            {
                foreach (var navItem in navigation.NavigationItems)
                {
                    //如果没有筛选项或数量过少就丢弃
                    if (navItem.SubNavigationItems == null ||
                        navItem.SubNavigationItems.Count == 0)
                    {
                        continue;
                    }

                    SearchFilterModel filterModel = new SearchFilterModel();
                    filterModel.ID   = (int)navItem.ItemType;
                    filterModel.Name = navItem.Name;

                    foreach (var subItem in navItem.SubNavigationItems)
                    {
                        SearchFilterItemModel itemModel = new SearchFilterItemModel();
                        itemModel.EnId         = subItem.Value;
                        itemModel.Name         = subItem.Name;
                        itemModel.ProductCount = subItem.NumberOfItem;
                        filterModel.Items.Add(itemModel);
                    }

                    result.Add(filterModel);
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public override Task Init(object args)
        {
            searchModel       = (SearchFilterItemModel)args;
            IsSearchAvailable = searchModel.IsSearchAvailable;
            Items             = new ObservableCollection <string>(searchModel.SearchItems);
            CurrentItem       = searchModel.GetAction.Invoke().FirstOrDefault();
            Title             = searchModel.Name;

            return(base.Init(args));
        }
        public override Task Init(object args)
        {
            searchModel = (SearchFilterItemModel)args;
            Items       = new ObservableCollection <string>(searchModel.SearchItems);
            var items = searchModel.GetAction.Invoke();

            if (items != null)
            {
                CurrentItems = new ObservableCollection <string>(items.Where(item => item != null));
            }
            Title = searchModel.Name;

            return(base.Init(args));
        }
 public JobListWithHeading(SearchFilterItemModel model)
 {
     Heading = model.Name;
     AddRange(model.SearchItems);
 }