private void AddRequirementButtonHandler(object sender, RoutedEventArgs e) { Button addButton = (Button)sender; var module = (Module)addButton.DataContext; var requirement = new Requirement() { Title = "New Requirement", Details = "New Requirement Details", TestCases = new List <Test>() }; module.Requirements.Add(requirement); LoadModules(); foreach (Expander m in ModuleExpanders.Children) { m.IsExpanded = true; } DisplayRequirement(requirement); SaveProject(); }
private void DisplayRequirement(Requirement requirement) { _selectedModule = _project.Modules.FirstOrDefault(x => x.Requirements.Contains(requirement)); _selectedRequirement = requirement; //Clear Side Panel TestCases.Children.Clear(); //Show Selected Details RequirementTitle.Text = requirement.Title; RequirementDetails.Text = requirement.Details; foreach (var testCase in requirement.TestCases) { var tcButton = new Button() { Content = testCase.TestName, DataContext = testCase, Margin = new Thickness(0, 2, 0, 2) }; TestCases.Children.Add(tcButton); } }
private void RequirementButtonHandler(object sender, RoutedEventArgs e) { Requirement req = (Requirement)((Button)sender).DataContext; DisplayRequirement(req); }