private async Task Initialize() { PageTitle = "New Order - Products"; var products = await stocklistService.GetProductListById(currentSubCategory.Id); Products = null; Products = new ObservableCollection <Product>(products); var orderList = await stocklistService.GetOrderList(); OrderList = null; OrderList = new ObservableCollection <Order>(orderList); }
public StocklistProductViewModel(SubCategory subCategory, INavigation navigation, IStocklistService slService) { this.navigation = navigation; this.currentSubCategory = subCategory; stocklistService = slService; LoadFile(); RefreshProducts(); MessagingCenter.Subscribe(this, MessageNames.ProductSaved, async(StocklistEditProductViewModel sender, Product product) => { Products = new ObservableCollection <Product>(await stocklistService.GetProductListById(currentSubCategory.Id)); }); }
private async Task RefreshProducts() { if (currentSubCategory != null) { PageTitle = "Overview Stocklist - " + currentSubCategory.Name; var products = await stocklistService.GetProductListById(currentSubCategory.Id); Products = null; Products = new ObservableCollection <Product>(products); } else { PageTitle = "New Subcategory List"; currentSubCategory = new SubCategory(); currentSubCategory.Id = Guid.NewGuid(); currentSubCategory.Products = new List <Product>(); } LoadProductState(); }