Пример #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;

            try {
                String[] files = Directory.GetFiles(@"I:\temp\Computer_specs", @"*.txt");
                Parallel.ForEach(files, processFile);

                List <Computer> com = new List <Computer>();

                foreach (Computer c in computers)
                {
                    if (!c.workstation.Contains("DKP"))
                    {
                        if (isNewestFile(c.workstation, c.modification))
                        {
                            com.Add(c);
                        }
                    }
                }

                if (files.Length != computers.Count)
                {
                    MessageBox.Show("Fout bij het inlezen van de computers");
                }

                computers = com;
                TotalPClist.AddObjects(computers);
            } catch (DirectoryNotFoundException) {
                MessageBox.Show("Geen computers gevonden");
            }
        }
Пример #2
0
 private void searchBox_TextChanged(object sender, EventArgs e)
 {
     if (searchBox.TextLength > 2)
     {
         TotalPClist.ClearObjects();
         foreach (Computer c in computers)
         {
             if (c.search(c, searchBox.Text))
             {
                 TotalPClist.AddObject(c);
             }
         }
     }
     else
     {
         TotalPClist.ClearObjects();
         TotalPClist.AddObjects(computers);
     }
 }