public void LoadShops() { if (!LoadShopsWorker.IsBusy) { LoadShopsWorker.RunWorkerAsync(); } }
private void LoadShopsWorker_DoWork(object sender, DoWorkEventArgs e) { Application.Current.Dispatcher.BeginInvoke(new Action(delegate { Mouse.OverrideCursor = Cursors.Wait; }), null); Application.Current.Dispatcher.BeginInvoke(new Action(delegate { Shops.Clear(); }), null); IsBusy = true; LoadingStep = "Chargement des boutiques ..."; Model.Prestashop.PsShopRepository PsShopRepository = new Model.Prestashop.PsShopRepository(); foreach (var shop in PsShopRepository.List()) { if (shop.IDShop == Global.CurrentShop.IDShop) { LoadShopsWorker.ReportProgress(0, shop); } } }