Exemplo n.º 1
0
        public static List <CollectionListItem> GetSubCategoryList(int id, bool forceRefresh = false)
        {
            if (SubCategories.ContainsKey(id) && !forceRefresh)
            {
                return(SubCategories[id]);
            }

            WallpaperResponse response = Get(buildUrl(LookupMethods.sub_category_list, InfoLevels.Basic, 1, 0, 0, SizeOperators.Equal, id));

            if (response == null)
            {
                LastResult = "An unknown error has occured!";
            }
            else if (response.SubCategories == null)
            {
                LastResult = response.ErrorMessage;
            }
            else
            {
                if (SubCategories.ContainsKey(id))
                {
                    SubCategories[id] = new List <CollectionListItem>(response.SubCategories);
                }
                else
                {
                    SubCategories.Add(id, new List <CollectionListItem>(response.SubCategories));
                }

                return(SubCategories[id]);
            }
            return(new List <CollectionListItem>());
        }