Exemple #1
0
        public async Task RefreshProductsAsync()
        {
            spProducts.Children.Clear();

            var selectedSortType  = (SortType)(cbSortType.SelectedValue ?? SortType.Name);
            var selectedSortOrder = (SortOrder)(cbSortOrder.SelectedValue ?? SortOrder.Ascending);

            var currentProducts = await productService.GetAllProductsAsync(searchText, selectedSortType, selectedSortOrder);

            foreach (var product in currentProducts)
            {
                var productControl = new ProductControl(product);
                spProducts.Children.Add(productControl);
            }

            tbSummary.Text = $"All products: {currentProducts.Count}";
        }