protected override async Task PreLoadAsync() { IRepository <Store> storeRepository = new SqlStoreRepository(); IRepository <Counterparty> counterpartyRepository = new SqlCounterpartyRepository(); var loadStore = Task.Run(() => storeRepository.GetListAsync(CancelTokenSource.Token), CancelTokenSource.Token); var loadCounterparty = Task.Run( () => counterpartyRepository.GetListAsync(CancelTokenSource.Token, CounterpartySpecification.GetCounterpartiesByType(ETypeCounterparties.Buyers)), CancelTokenSource.Token); await Task.WhenAll(loadStore, loadCounterparty); DisposalStoresList = new ObservableCollection <Store>(loadStore.Result); CounterpartiesList = new ObservableCollection <Counterparty>(loadCounterparty.Result); }
protected override async Task InLoad() { IRepository <Store> storeRepository = new SqlStoreRepository(); IRepository <Currency> currencyRepository = new SqlCurrencyRepository(); IRepository <Counterparty> counterpartyRepository = new SqlCounterpartyRepository(); var loadStore = Task.Run(() => storeRepository.GetListAsync(CancelTokenLoad.Token), CancelTokenLoad.Token); var loadCurrency = Task.Run(() => currencyRepository.GetListAsync(CancelTokenLoad.Token), CancelTokenLoad.Token); var loadCounterparty = Task.Run( () => counterpartyRepository.GetListAsync(CancelTokenLoad.Token, CounterpartySpecification.GetCounterpartiesByType(ETypeCounterparties.Suppliers)), CancelTokenLoad.Token); await Task.WhenAll(loadStore, loadCurrency, loadCounterparty); ArrivalStoresList = new ObservableCollection <Store>(loadStore.Result); CurrenciesList = new ObservableCollection <Currency>(loadCurrency.Result); EquivalentCurrenciesList = new ObservableCollection <Currency>(loadCurrency.Result); CounterpartiesList = new ObservableCollection <Counterparty>(loadCounterparty.Result); }