public async void initData(List <Library.Models.ProductSearch> searchList) { CustomerWindow.Instance.startWaitting(); foreach (var item in searchList) { DisplayProduct newDisplay = new DisplayProduct(); newDisplay.Margin = new Thickness(12); newDisplay.initData(item.ProductId); this.productSearchPanel.Children.Add(newDisplay); } CustomerWindow.Instance.endWatting(); }
public async Task initAllProduct(List <string> allProductId) { await Task.Factory.StartNew(() => { foreach (string id in allProductId) { this.Dispatcher.Invoke(() => { DisplayProduct product = new DisplayProduct(); product.Margin = new Thickness(12); product.initData(id); allProductPanel.Children.Add(product); }); } }); }