public TesterMain() { InitializeComponent(); DataContext = this; lvGroupCase.DataContext = TestGroupCaseOc; lvcmGroupCase.DataContext = this; dgGlobalCfg.DataContext = TestConfiguraionGlobalOc; //lvPrivateCfg.DataContext = TestConfiguraionLocalOc; dgTestResults.DataContext = TestResultOc; TestResultOc.CollectionChanged += new NotifyCollectionChangedEventHandler(TestResultOc_CollectionChanged); TestColInstance = new TestCollection(TestGroupCaseOc); InitApplicationFolders(); OpenConfig(); _timer.Tick += new EventHandler(Timer_Tick); _timer.Interval = new TimeSpan(1000 * 1000); GlobalCfg_ListView_SelectionChanged(null, null); //PrivateCfg_ListView_SelectionChanged(null, null); }
/// <summary> /// /// </summary> /// <param name="testColInst"></param> /// <param name="groupCaseName"></param> /// <param name="level"></param> /// <param name="isCase"></param> /// <param name="testBaseInst"></param> /// <param name="testFilePath"></param> public TestGroupCase(TestCollection testColInst, TestGroupCase parent, string groupCaseName, bool isCase, iTestBase testBaseInst, string testFilePath) { if (testColInst == null) throw new ArgumentNullException("Cannot initialize TestGroupCase() because of the null parameter."); GlobalIndex = TestCollection.GetGlobalIndex(); TestColInstance = testColInst; GroupCaseName = groupCaseName; int level = 0; TestGroupCase tgc = parent; while (tgc != null) { level++; tgc = tgc.TestGroupCaseParent; } DisplayLevel = level; IsCase = isCase; TestBaseInstance = testBaseInst; if (IsCase == true) TestBaseInstance.TestGroupCaseLocal = this; TestFilePath = testFilePath; GroupCaseImage = new BitmapImage(); GroupCaseImage.BeginInit(); if (IsCase == true) GroupCaseImage.UriSource = new Uri("pack://application:,,,/Testempo;component/resources/group_case.png"); else { if (TestGroupCaseOc.Count > 1) { GroupCaseImage.UriSource = new Uri("pack://application:,,,/Testempo;component/resources/group_expand.png"); _isExpanded = true; } else { GroupCaseImage.UriSource = new Uri("pack://application:,,,/Testempo;component/resources/group_collaps.png"); _isExpanded = false; } } GroupCaseImage.EndInit(); //if (IsCase == true) //{ // PassImage = new BitmapImage(); // PassImage.BeginInit(); // PassImage.UriSource = new Uri("pack://application:,,,/Testempo;component/resources/status_ok.png"); // PassImage.EndInit(); // FailImage = new BitmapImage(); // FailImage.BeginInit(); // FailImage.UriSource = new Uri("pack://application:,,,/Testempo;component/resources/status_error.png"); // FailImage.EndInit(); //} if (parent != null) { TestGroupCaseParent = parent; int index = TestColInstance.FindLastSubGroupCaseDisplayIndex(parent); parent.TestGroupCaseOc.Add(this); TestGroupCaseParent.IsExpanded = true; TestColInstance.TestGroupCaseOcDisp.Insert(index + 1, this); } else { TestColInstance.TestGroupCaseOc.Add(this); TestColInstance.TestGroupCaseOcDisp.Add(this); } if (IsCase == true) TestBaseInstance.RunCountChangedEvent += new EventHandler<RunCountChangedEventArgs>(TestBaseInstance_RunCountChangedEvent_EventHandler); }