private void timer1_Tick(object sender, EventArgs e)
{
try
{
numbers = Convert.ToInt64(textBox1.Text);
if (numbers <= 0)
{
timer1.Stop();
button1.Enabled = true;
textBox1.Enabled = true;
MessageBox.Show("Value cannot be zero or below zero");
textBox1.Text = "";
}
else
{
Numbers_Timer = Numbers_Timer + 1;
if (Numbers_Timer == numbers)
{
filesdownload();
button1.Enabled = false;
Numbers_Timer = 0;
}
// String str = string.Format("Hours {0} Minutes {1} Seconds {2}", c, d, e);
time_left = numbers - Numbers_Timer;
label1.Text = "Time left for next download: " + time_left;
// y = numbers - 1;
// label1.Text = "Time left for next download: " +y;
/* if (a == 1)
{
a=numbers;
button1.Enabled = false;
} */
//String str = string.Format("Hours {0} Minutes {1} Seconds {2}", c, d, e);
// this.label1.Text = str;
/* String str = string.Format("{0} {1}", c, d);
this.textBox1.Text = str;
c = c - 1;
d = d - 1; */
}
}
catch (Exception General_Exceptions)
{
timer1.Stop();
int size = textBox1.Text.Length;
if (size != 0)
{
MessageBox.Show("Sorry you cannot enter letters into the textbox.");
}
else
{
Logger.Write("Exception: " + General_Exceptions);
MessageBox.Show("test:" + General_Exceptions);
}
textBox1.Clear();
button1.Enabled = true;
textBox1.Enabled = true;
}
}