public async Task LoadTestsAsync() { IsBusy = true; // Factories var factoriesResult = await Task.Run(() => { List <FactoryViewModel> factories = new List <FactoryViewModel>(); foreach (var factory in _engine.GetProviderFactories()) { var vm = new FactoryViewModel { Factory = factory }; try { using (var provider = vm.Factory.CreateProvider()) vm.Version = provider.GetVersion(); } catch (Exception ex) { vm.Version = $"ERR: {ex.Message}"; } factories.Add(vm); } return(factories); }); Factories.Clear(); foreach (var f in factoriesResult) { Factories.Add(f); } // Tests var testsResult = await Task.Run(() => { List <TestViewModel> tests = new List <TestViewModel>(); foreach (var test in _engine.GetTests()) { var vm = new TestViewModel { Test = test, IsSelected = true }; tests.Add(vm); } return(tests); }); Tests.Clear(); foreach (var t in testsResult) { Tests.Add(t); } IsBusy = false; }