/// <summary> /// Called when a this instance becomes the active content in a frame. /// </summary> /// <param name="e">An object that contains the navigation data.</param> public void OnNavigatedTo(NavigationEventArgs e) { this.editViewContext = new EditViewContext(); UndoRedoManager.Instance().Clear(); this.editViewContext.IsInitialized = false; ComboBoxDropdownExtensions.SetOpenDropDownAutomatically(this.cbArea, TestCaseManagerCore.ExecutionContext.SettingsViewModel.HoverBehaviorDropDown); ComboBoxDropdownExtensions.SetOpenDropDownAutomatically(this.cbPriority, TestCaseManagerCore.ExecutionContext.SettingsViewModel.HoverBehaviorDropDown); }
/// <summary> /// Initializes a new instance of the <see cref="TestCaseEditViewModel"/> class. /// </summary> /// <param name="editViewContext">The edit view context.</param> public TestCaseEditViewModel(EditViewContext editViewContext) { this.EditViewContext = editViewContext; this.Areas = this.GetProjectAreas(); this.ObservableTestSteps = new ObservableCollection<TestStep>(); this.GenericParameters = new Dictionary<string, Dictionary<string, string>>(); if (!this.EditViewContext.IsSharedStep) { this.ShowTestCaseSpecificFields = true; ITestSuiteBase testSuiteBaseCore = null; if (this.EditViewContext.TestSuiteId != -1) { testSuiteBaseCore = TestSuiteManager.GetTestSuiteById(TestCaseManagerCore.ExecutionContext.TestManagementTeamProject, TestCaseManagerCore.ExecutionContext.Preferences.TestPlan, this.EditViewContext.TestSuiteId); } if (this.EditViewContext.CreateNew && !this.EditViewContext.Duplicate) { ITestCase newTestCase = TestCaseManagerCore.ExecutionContext.TestManagementTeamProject.TestCases.Create(); this.TestCase = new TestCase(newTestCase, testSuiteBaseCore, TestCaseManagerCore.ExecutionContext.Preferences.TestPlan, false); } else { ITestCase testCaseCore = TestCaseManagerCore.ExecutionContext.TestManagementTeamProject.TestCases.Find(this.EditViewContext.TestCaseId); this.TestCase = new TestCase(testCaseCore, testSuiteBaseCore, TestCaseManagerCore.ExecutionContext.Preferences.TestPlan, false); } this.ObservableSharedSteps = new ObservableCollection<SharedStep>(); this.InitializeObservableSharedSteps(); this.InitializeInitialSharedStepCollection(); this.InitializeTestCaseTestStepsFromITestCaseActions(); this.AssociatedAutomation = this.TestCase.ITestCase.GetAssociatedAutomation(); this.TestBase = this.TestCase; } else { if (this.EditViewContext.CreateNew && !this.EditViewContext.Duplicate) { ISharedStep currentSharedStepCore = TestCaseManagerCore.ExecutionContext.TestManagementTeamProject.SharedSteps.Create(); this.SharedStep = new SharedStep(currentSharedStepCore); } else { SharedStep currentSharedStep = SharedStepManager.GetSharedStepById(TestCaseManagerCore.ExecutionContext.TestManagementTeamProject, this.EditViewContext.SharedStepId); this.SharedStep = currentSharedStep; } List<TestStep> innerTestSteps = TestStepManager.GetAllTestStepsInSharedStep(this.SharedStep.ISharedStep, false); this.AddTestStepsToObservableCollection(innerTestSteps); this.ShowTestCaseSpecificFields = false; this.TestBase = this.SharedStep; this.ClearTestStepNames(); } this.InitializeIdLabelFromTestBase(this.EditViewContext.CreateNew, this.EditViewContext.Duplicate); this.InitializePageTitle(); log.InfoFormat("Load Edit View with Context: {0} ", editViewContext); TestStepManager.UpdateGenericSharedSteps(this.ObservableTestSteps); }