예제 #1
0
        private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            ListShop = new List <ShopModel>();
            List <ProductPair> ResultList = new List <ProductPair>();

            if (string.IsNullOrEmpty(e.NewTextValue))
            {
                List1.ItemsSource = PairListShop;
            }

            //else
            //{
            //    //List1.ItemsSource = PairListShop.Where(x => x.Item1.Title.ToLower().StartsWith(e.NewTextValue.ToLower()));
            //}
            else
            {
                foreach (ProductPair pp in PairListShop)
                {
                    //x.Item1.Title.ToLower().StartsWith(e.NewTextValue.ToLower())
                    if (pp.Item1.Title.ToLower().StartsWith(e.NewTextValue.ToLower()))
                    {
                        ListShop.Add(pp.Item1);
                    }
                    if (pp.Item2.Title.ToLower().StartsWith(e.NewTextValue.ToLower()))
                    {
                        ListShop.Add(pp.Item2);
                    }
                }

                for (int i = 0; i < ListShop.Count; i = i + 1)
                {
                    if (i < ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], ListShop[i + 1]);
                        ResultList.Add(pp);
                    }
                    else if (i == ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], null);
                        ResultList.Add(pp);
                    }
                }
                List1.ItemsSource = ResultList;
            }
        }
예제 #2
0
        private void TapGestureRecognizer_OnTapped(object sender, EventArgs e)
        {
            ListShop = new List <ShopModel>();
            List <ProductPair> ResultList = new List <ProductPair>();

            if (sender.Equals(Travel))
            {
                Tab1Visible = true;
                Tab2Visible = false;
                Tab3Visible = false;
                Tab4Visible = false;
                //Travel.TextColor = Color.White;
                //Shoes.TextColor = Color.Gray;
                //Bags.TextColor = Color.Gray;
                //Accessoreis.TextColor = Color.Gray;
                Travel.FontSize      = 24;
                Shoes.FontSize       = 18;
                Bags.FontSize        = 18;
                Accessoreis.FontSize = 18;
                foreach (ProductPair pp in PairListShop)
                {
                    if (pp.Item1.Categorie.Equals("Travel"))
                    {
                        ListShop.Add(pp.Item1);
                    }
                    if (pp.Item2.Categorie.Equals("Travel"))
                    {
                        ListShop.Add(pp.Item2);
                    }
                }
                for (int i = 0; i < ListShop.Count; i = i + 1)
                {
                    if (i < ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], ListShop[i + 1]);
                        ResultList.Add(pp);
                    }
                    else if (i == ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], null);
                        ResultList.Add(pp);
                    }
                }
            }
            if (sender.Equals(Shoes))
            {
                Tab1Visible = false;
                Tab2Visible = true;
                Tab3Visible = false;
                Tab4Visible = false;
                //ListShop = new List<ShopModel>();
                //Travel.TextColor = Color.Gray;
                //Shoes.TextColor = Color.White;
                //Bags.TextColor = Color.Gray;
                //Accessoreis.TextColor = Color.Gray;
                Travel.FontSize      = 18;
                Shoes.FontSize       = 24;
                Bags.FontSize        = 18;
                Accessoreis.FontSize = 18;
                foreach (ProductPair pp in PairListShop)
                {
                    if (pp.Item1.Categorie.Equals("Shoes"))
                    {
                        ListShop.Add(pp.Item1);
                    }
                    if (pp.Item2.Categorie.Equals("Shoes"))
                    {
                        ListShop.Add(pp.Item2);
                    }
                }

                for (int i = 0; i < ListShop.Count; i = i + 1)
                {
                    if (i < ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], ListShop[i + 1]);
                        ResultList.Add(pp);
                    }
                    else if (i == ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], null);
                        ResultList.Add(pp);
                    }
                }
            }
            if (sender.Equals(Bags))
            {
                Tab1Visible = false;
                Tab2Visible = false;
                Tab3Visible = true;
                Tab4Visible = false;
                //ListShop = new List<ShopModel>();
                //Travel.TextColor = Color.Gray;
                //Shoes.TextColor = Color.Gray;
                //Bags.TextColor = Color.White;
                //Accessoreis.TextColor = Color.Gray;

                Travel.FontSize      = 18;
                Shoes.FontSize       = 18;
                Bags.FontSize        = 24;
                Accessoreis.FontSize = 18;
                foreach (ProductPair pp in PairListShop)
                {
                    if (pp.Item1.Categorie.Equals("Bags"))
                    {
                        ListShop.Add(pp.Item1);
                    }
                    if (pp.Item2.Categorie.Equals("Bags"))
                    {
                        ListShop.Add(pp.Item2);
                    }
                }

                for (int i = 0; i < ListShop.Count; i = i + 1)
                {
                    if (i < ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], ListShop[i + 1]);
                        ResultList.Add(pp);
                    }
                    else if (i == ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], null);
                        ResultList.Add(pp);
                    }
                }
            }

            if (sender.Equals(Accessoreis))
            {
                Tab1Visible = false;
                Tab2Visible = false;
                Tab3Visible = false;
                Tab4Visible = true;
                //ListShop = new List<ShopModel>();
                //Travel.TextColor = Color.Gray;
                //Shoes.TextColor = Color.Gray;
                //Bags.TextColor = Color.Gray;
                //Accessoreis.TextColor = Color.White;
                Travel.FontSize      = 18;
                Shoes.FontSize       = 18;
                Bags.FontSize        = 18;
                Accessoreis.FontSize = 24;
                foreach (ProductPair pp in PairListShop)
                {
                    if (pp.Item1.Categorie.Equals("Accessoreis"))
                    {
                        ListShop.Add(pp.Item1);
                    }
                    if (pp.Item2.Categorie.Equals("Accessoreis"))
                    {
                        ListShop.Add(pp.Item2);
                    }
                }

                for (int i = 0; i < ListShop.Count; i = i + 1)
                {
                    if (i < ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], ListShop[i + 1]);
                        ResultList.Add(pp);
                    }
                    else if (i == ListShop.Count - 1)
                    {
                        ProductPair pp = new ProductPair(ListShop[i], null);
                        ResultList.Add(pp);
                    }
                }
            }
            List1.ItemsSource = ResultList;
        }