private void bestSellersBtn_Click(object sender, EventArgs e)
 {
     if (PnlContainer.Controls.ContainsKey("BestSellers"))
     {
         int index = PnlContainer.Controls.IndexOfKey("BestSellers");
         PnlContainer.Controls[index].BringToFront();
     }
     else
     {
         BestSellers bestSellers = new BestSellers();
         bestSellers.Dock = DockStyle.Fill;
         PnlContainer.Controls.Add(bestSellers);
         bestSellers.BringToFront();
     }
 }
Esempio n. 2
0
        private void LoadBestSellers(bool toSwitch)
        {
            //Loads the best sellers
            Tuple <object, HttpStatusCode> returnTuple = httpClient.PostRequest(ApiConfigs.GetBestSellersRoute);

            if (returnTuple.Item2 == HttpStatusCode.OK)
            {
                JArray jarr = new JArray();
                jarr = (JArray)returnTuple.Item1;
                BestSellers.Clear();
                foreach (var item in jarr.ToObject <List <User> >())
                {
                    BestSellers.Add(item);
                }
            }
            else
            {
                logger.Print(returnTuple.Item2.ToString());
            }
            if (toSwitch)
            {
                BestSellersSwitch = true;
            }
        }