コード例 #1
0
        /*
         * Queries the service for all brand filters and then updates the view with
         * the result of the query
         */
        private void LoadBrandFilters()
        {
            //Fetch the list of catalog item brands
            IEnumerable <CatalogBrand> brands = _service.GetCatalogBrands();

            // Bind combobox to dictionary
            Dictionary <int, string> brandDictionary = new Dictionary <int, string>();

            //The service does not return an 'all' item by default, so we must add it.
            brandDictionary.Add(0, "All");

            // Add rest of type filters
            foreach (var catalogBrand in brands)
            {
                int    idValue   = catalogBrand.Id;
                string typeValue = catalogBrand.Brand;
                brandDictionary.Add(idValue, typeValue);
            }

            _view.SetBrandFilter(brandDictionary);
        }