private void MenuItemRemove_Click(object sender, RoutedEventArgs e)
 {
     foreach (RemoteComputer computer in selectedItems)
     {
         ActiveTestbed.Remove(computer);
     }
 }
 public void MenuItemRemoveFromDb_Click(object sender, RoutedEventArgs e)
 {
     foreach (RemoteComputer computer in selectedItems)
     {
         ActiveTestbed.Remove(computer);
         new GeneralUtils().DeleteComputerFromAllTables(computer.ID);
     }
 }
        private static void AddAllComputersTo()
        {
            DataTable table = new Computers().SelectAll();

            foreach (DataRow row in table.Rows)
            {
                ActiveTestbed.Add(new RemoteComputer(row));
            }
        }
Exemplo n.º 4
0
        // 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();
        }
Exemplo n.º 5
0
        // 1. Input validation
        // 2. Generate a new testbed ID
        // 3. Insert the new testbed
        // 4. Add the items in the GUI to the relations table with this new ID
        public static void Save(string name = "")
        {
            if (ActiveTestbed.IsEmpty())
            {
                return;
            }

            if (name == "")
            {
                name = Resources.DefaultTestbedName;
            }

            int nextTestbedID = testbedsTable.GetNextID();

            testbedsTable.Insert(name);

            foreach (RemoteComputer item in Master.table.dataGrid.Items)
            {
                relationsTable.Insert(item.ID, nextTestbedID);
            }
        }
        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();
        }
Exemplo n.º 8
0
 private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     ActiveTestbed.Update((RemoteComputer)e.Result);
 }