// 1. Get list of testbed titles // 2. Get list of computers for each testbed // 3. Add each list and its contents to the tree // 4. Add all of the computers in the DB to the master tree private void WindowListBrowserWindow_Loaded(object sender, RoutedEventArgs e) { DataTable allTestbeds = new Testbeds().SelectAll(); foreach (DataRow row_testbed in allTestbeds.Rows) { // Loop through each testbed Testbed testbed = new Testbed((int)row_testbed["ID"], (string)row_testbed["Title"]); // Find all of the relations for this testbed ID DataTable testbedRelations = new TestbedRelations().FindByTestbedID((int)row_testbed["ID"]); foreach (DataRow row_relation in testbedRelations.Rows) { // Get the computer information for this ID DataTable table_computer = new Computers().Find((int)row_relation["ComputerID"]); foreach (DataRow row_computer in table_computer.Rows) { testbed.Add(new RemoteComputer(row_computer)); } } listTree.AddList((string)row_testbed["Title"], testbed); } DisplayAllInMasterList(); }
public static Testbed ToTestbed(List <RemoteComputer> list) { Testbed testbed = new Testbed(); foreach (var item in list) { testbed.items.Add(item); } return(testbed); }
public void AddList(string title, Testbed contents) { TreeViewItem listItem = new TreeViewItem { Header = title, IsExpanded = true }; treeview.Items.Add(listItem); try { foreach (var item in contents.items) { TreeViewItem computerItem = new TreeViewItem { Header = item.hostname }; listItem.Items.Add(computerItem); } } catch (Exception ex) { DebugLog.DebugLog.Log(ex); } }
/// <summary> /// When a Testbed changes its state, update the GUI. /// </summary> /// <param name="computer"></param> public void Update(Testbed testbed) { }