private static void AddAllComputersTo() { DataTable table = new Computers().SelectAll(); foreach (DataRow row in table.Rows) { ActiveTestbed.Add(new RemoteComputer(row)); } }
// 1. Get a list of all the computers with this ID in the relations table // 2. Add each of these to the activetestbed // 3. Save the "most recent list" setting. public static void Load(int id) { DataTable table = relationsTable.FindByTestbedID(id); foreach (DataRow row in table.Rows) { DataTable table_computer = computersTable.Find((int)row["ComputerID"]); foreach (DataRow row_computer in table_computer.Rows) { ActiveTestbed.Add(new RemoteComputer(row_computer)); } } Settings.Default.MostRecentList = id; Settings.Default.Save(); }
private static void AddMostRecentListTo() { // Get all the computers in the most recent list. DataTable table = new TestbedRelations().FindByTestbedID( Settings.Default.MostRecentList); // Get the information for each computer in the most recent list. foreach (DataRow row in table.Rows) { DataTable table_computer = new Computers().Find( (int)row["ComputerID"]); // Add each computer's information to the testbed object. foreach (DataRow row_computer in table_computer.Rows) { ActiveTestbed.Add(new RemoteComputer(row_computer)); } } Master.main.ChangeStatusBarText("Loaded most recent testbed."); }
private void ButtonAdd_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBoxHostnameIp.Text.Trim())) { return; } string encryptedPassword = Encryption.Encrypt(PasswordBoxPassword.Password); ConnectionInfoChecker checker = new ConnectionInfoChecker(); RemoteComputer computer = checker.GetValidRemoteComputer( TextBoxHostnameIp.Text, TextBoxUsername.Text, encryptedPassword); if (computer != null) { ActiveTestbed.Add(computer); } Close(); }