private void BC_Button_Click(object sender, RoutedEventArgs e) { // Clear current Box PropertyBox.Children.Clear(); // Create new BC, add to Database and Viewport BoundaryCondition NewBC; if (DB.BCLib.Count != 0) { NewBC = new BoundaryCondition("New Boundary Condition", "SPC", DB.BCLib.Last().Value.ID + 1); } else { NewBC = new BoundaryCondition("New Boundary Condition", "SPC", 1); } NewBC.Initialize(); DB.BCLib.Add(NewBC.ID, NewBC); // Add new BC to GUI Fun.AddBC2GUI(NewBC, iRen, Tree, true); // Add Property Card BOX_BC NewBox = new BOX_BC(NewBC, DB, Tree, iRen, BC_Arrow_scale, ResControl.Step); PropertyBox.Children.Add(NewBox); }
// ============================= TREEVIEW METHODS =================================== private void TreeItemSelect(object sender, RoutedPropertyChangedEventArgs <object> e) { if (ModelLoaded) { // Clear current Box PropertyBox.Children.Clear(); // Hide all BC Actors if (DB.BCLib != null) { foreach (BoundaryCondition bc in DB.BCLib.Values) { bc.HideActor(); } } // Catch selected item Header TreeViewItem item = (TreeViewItem)Tree.SelectedItem; string label = item.Header.ToString(); // Display BOUNDARY CONDITION Property Box if (label.Contains("BC ID")) { // Catch selected BC ID int ID = int.Parse(Fun.Between(label, "ID ", ":")); // Update Arrows to current Analysis step and display BC Actor DB.BCLib[ID].Update_Arrows(DB.NodeLib, BC_Arrow_scale, ResControl.Step, ClipMode); DB.BCLib[ID].ShowActor(); // Add new BC Box to PropertyBox BOX_BC NewBox = new BOX_BC(DB.BCLib[ID], DB, Tree, iRen, BC_Arrow_scale, ResControl.Step); PropertyBox.Children.Add(NewBox); } // Display PART Property Box if (label.Contains("Part ID")) { // Catch selected Part ID int ID = int.Parse(Fun.Between(label, "ID ", ":")); // Add new Part Box to PropertyBox BOX_Part NewBox = new BOX_Part(DB.PartLib[ID], DB, Tree, iRen); PropertyBox.Children.Add(NewBox); } // Display MATERIAL Property Box if (label.Contains("Mat ID")) { // Catch selected Part ID int ID = int.Parse(Fun.Between(label, "ID ", ":")); // Add new Mat Box to PropertyBox BOX_Mat NewBox = new BOX_Mat(DB.MatLib[ID], DB, Tree); PropertyBox.Children.Add(NewBox); } // Display ANALYSIS Property Box if (label == "Analysis") { //Add new Analysis Bix to PropertyBox BOX_Analysis NewBox = new BOX_Analysis(DB); PropertyBox.Children.Add(NewBox); } // Display RESULT Property Box if (label == "Results") { // Add new Result Box to PropertyBox BOX_Result NewBox = new BOX_Result(ResControl, DB, iRen); PropertyBox.Children.Add(NewBox); } iRen.Refresh(); // Refresh View } }