コード例 #1
0
        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);
                    })
                });
            }
        }
コード例 #2
0
        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.ToString(),
                                    "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.SaveTestCollectionInfo(testCollection);
                            })
                    });
            }
        }