Esempio n. 1
0
        /// <summary>
        /// Initializes the RetailButtons list which is bound to the 35 UI retail buttons
        /// in the calculators
        /// </summary>
        /// <seealso cref="RetailButtons"/>
        /// <seealso cref="UpdateRetailButtons()"/>
        public void InitializeRetailButtons()
        {
            RetailButton newButton = new RetailButton();

            for (int i = 0; i < 35; ++i)
            {
                RetailButtons.Add(newButton);
            }

            UpdateRetailButtons();
        }
Esempio n. 2
0
        /// <summary>
        /// Updates RetailButtons list with retailers from the database
        /// </summary>
        /// <seealso cref="RetailButtons"/>
        /// <seealso cref="SortByName(ObservableCollection{Retailer}))"/>
        public void UpdateRetailButtons()
        {
            Handlers.Database db = new Handlers.Database();
            var retailerList     = db.LoadAllRetailers();

            SortByName(retailerList);

            int i = 0;

            foreach (Retailer item in retailerList)
            {
                RetailButton newButton = new RetailButton();
                newButton.Retailer   = item;
                newButton.Visibility = true;
                RetailButtons.RemoveAt(i);
                RetailButtons.Insert(i, newButton);
                ++i;
            }
        }