private void LoadManifest(ManifestViewModel manifestViewModel) { if (manifestViewModel == null) { return; } Manifest manifest = null; try { manifest = _manifestService.GetManifest(SelectedManifest.Name); } catch (Exception e) { MessageBox.Show(e.Message, "Error Loading Manifest", MessageBoxButton.OK, MessageBoxImage.Error); } if (manifest == null) { return; } manifestViewModel.TestCollections.Clear(); SelectedManifest.DomainOverride = manifest.OverrideDomain; foreach (var testCollectionFile in manifest.Files) { TestCollection testCollection = null; try { testCollection = _testCollectionService.GetTestCollection(testCollectionFile); } catch (Exception e) { MessageBox.Show("TestCollection: " + testCollectionFile + Environment.NewLine + e.Message, "Error Loading TestCollection", MessageBoxButton.OK, MessageBoxImage.Error); } if (testCollection == null) { continue; } manifestViewModel.TestCollections.Add(new TestCollectionSummaryViewModel { IsEnabled = testCollection.Enabled, Name = testCollection.File, IsEnabledChangedCommand = new RelayCommand(enabled => { testCollection.Enabled = (bool)enabled; _testCollectionService.SaveTestCollection(testCollection); }) }); } }
private void LoadTestCollections() { IList <string> testCollectionFiles = null; try { testCollectionFiles = _testCollectionServiceService.GetTestCollectionFiles(); } catch (Exception e) { MessageBox.Show(e.Message, "Error Loading TestCollections", MessageBoxButton.OK, MessageBoxImage.Error); } if (testCollectionFiles == null) { return; } foreach (var testCollectionFile in testCollectionFiles) { TestCollection testCollection = null; try { testCollection = _testCollectionServiceService.GetTestCollection(testCollectionFile); } catch (Exception e) { MessageBox.Show("TestCollection: " + testCollectionFile + Environment.NewLine + e.Message, "Error Loading TestCollection", MessageBoxButton.OK, MessageBoxImage.Error); } if (testCollection == null) { return; } var testCollectionViewModel = new TestCollectionViewModel { Domain = testCollection.DefaultDomain, IsEnabled = testCollection.Enabled, Name = testCollection.File }; if (testCollection.Tests == null) { return; } foreach (var test in testCollection.Tests) { var testViewModel = new TestViewModel { IsEnabled = test.Enabled, Name = test.Name, Url = test.Url, IsEnabledChangedCommand = new RelayCommand(enabled => { test.Enabled = (bool)enabled; _testCollectionServiceService.SaveTestCollection(testCollection); }) }; if (test.Commands == null) { return; } foreach (var command in test.Commands) { var commandViewModel = new CommandViewModel { Name = command.Name, Command = command, }; var properties = _commandService.GetCommandValues(command); foreach (var item in properties) { commandViewModel.Properties.Add(new CommandPropertyViewModel { Name = item.Key, Value = item.Value }); } testViewModel.Children.Add(commandViewModel); } testCollectionViewModel.Children.Add(testViewModel); } TestCollections.Add(testCollectionViewModel); } }