예제 #1
0
 private void SectorCleaner_Load(object sender, EventArgs e)
 {
     comboBox1.Items.Clear();
     foreach (DriveInfo d in SectorCleanerAlgorithm.GetDrives())
     {
         comboBox1.Items.Add(d.Name);
     }
 }
예제 #2
0
        private void Sector_Selected(string letter)
        {
            sectorCleanerAlgorithm = new SectorCleanerAlgorithm();
            sectorCleanerAlgorithm.SetDriveLetter(letter);
            sectorCleanerAlgorithm.OnCleanerStarted  += SectorCleanerAlgorithm_OnCleanerStarted;
            sectorCleanerAlgorithm.OnCleanerProgress += SectorCleanerAlgorithm_OnCleanerProgress;
            sectorCleanerAlgorithm.OnCleanerFinished += SectorCleanerAlgorithm_OnCleanerFinished;
            sectorCleanerAlgorithm.OnCleanerCleaning += SectorCleanerAlgorithm_OnCleanerCleaning;
            if (sector != null)
            {
                sector.Close();
            }
            Console.WriteLine("Selected Drive is " + letter);
            Console.WriteLine("Steps :" + sectorCleanerAlgorithm.Steps());

            progressBar1.Step    = 1;
            progressBar1.Maximum = (int)sectorCleanerAlgorithm.Steps() + 2;
            progressBar1.Value   = 0;
            Console.WriteLine("progressbar maximum : " + progressBar1.Maximum);

            Thread thr = new Thread(new ThreadStart(sectorCleanerAlgorithm.clean));

            thr.Start();
        }