Beispiel #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     time_label.Text = Counter.ToString();
     if (textBox1.Text != "")
     {
         if (Directory.Exists(textBox1.Text))
         {
             FileToDelete_label.Text = Directory.GetFiles(textBox1.Text, "*.*", SearchOption.AllDirectories).Length.ToString();
             Counter--;
             if (Counter == 0)
             {
                 try
                 {
                     DeleteFilesAndFolders instance = new DeleteFilesAndFolders(textBox1.Text);
                     t = new Thread(() => instance.Delete());
                     t.Start();
                 }
                 catch
                 {
                 }
                 Counter = decimal.ToInt32(numericUpDown1.Value);
             }
         }
     }
 }
Beispiel #2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                if (Directory.Exists(textBox1.Text))
                {
                    FileToDelete_label.Text = Directory.GetFiles(textBox1.Text, "*.*", SearchOption.AllDirectories).Length.ToString();

                    if (int.Parse(FileToDelete_label.Text) >= int.Parse(FileToDelete_textBox.Text))
                    {
                        try
                        {
                            DeleteFilesAndFolders instance = new DeleteFilesAndFolders(textBox1.Text);
                            t = new Thread(() => instance.Delete());
                            t.Start();
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }