Exemplo n.º 1
0
        private async void Category_OnClick(object sender, EventArgs e)
        {
            var view             = (View)sender;
            var selectedCategory = (SubCategoryModel)view.BindingContext;
            var category         = await ViewModel.GetCategoryByIdAsync(selectedCategory.Id);

            if (category.SubCategories.Any())
            {
                var categoryPage = new CategoriesPage()
                {
                    Title          = category.Name,
                    BindingContext = new CategoriesViewModel()
                    {
                        Category = category,
                        Title    = category.Name,
                    }
                };

                await Navigation.PushAsync(categoryPage);
            }
            else
            {
                if (category.Products.Any())
                {
                    var categoryPage = new CategoryPage()
                    {
                        Title          = category.Name,
                        BindingContext = new CategoryViewModel()
                        {
                            Category = category,
                            Title    = category.Name,
                        }
                    };

                    await Navigation.PushAsync(categoryPage);
                }
                else
                {
                    //add popup notification ToDo
                }
            }
        }
Exemplo n.º 2
0
 public CategoriesPage()
 {
     InitializeComponent();
     Page = this;
 }