Пример #1
0
        // 1. Check if it already exists
        // 2. Add to the GUI table
        // 3. Add to the GUI tabs
        // 4. Add to the database and set its ID
        // 5. Start monitoring the network connection
        public static void Add(RemoteComputer computer)
        {
            if (Master.table.TableContainsHostname(computer.hostname))
            {
                Master.main.ChangeStatusBarText(computer.hostname + " already exists.");
                return;
            }

            Master.table.dataGrid.Items.Add(computer);

            Master.logManager.Add(computer);

            if (computersTable.Find(computer.hostname).Rows.Count == 0)
            {
                computer.ID = computersTable.Insert(
                    computer.hostname,
                    computer.ipAddressStr,
                    computer.credentials.UserName,
                    computer.credentials.Password);

                DebugLog.DebugLog.Log("Added new computer (" + computer.ID + ", " +
                                      computer.hostname + ", " + computer.ipAddressStr + ") to the database.");
            }

            new ConnectionMonitor(computer);

            Master.main.ChangeStatusBarText(computer.ipAddressStr + " added.");
        }
Пример #2
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();
        }
Пример #3
0
 public bool TryGetComputerByName(string name, out Computer computer) => (computer = Computers.Find(x => x.Name == name)) != null;
Пример #4
0
 public bool TryGetComputerByIp(string ip, out Computer computer) => (computer = Computers.Find(x => x.IP == ip)) != null;