So, i was trying to make a delay in my program without freezing the GUI, and i got the answer, but now i got another problem.. Why doesn't this code execute well?
private void activate_b_Click(object sender, EventArgs e) { string cstrike = pathbox.Text; if (Directory.Exists(cstrike) && File.Exists(cstrike + @"\config.cfg")) // postoji li cstrike folder & config.cfg { string config = cstrike + @"\config.cfg"; var t1 = new System.Windows.Forms.Timer { Enabled = true, Interval = 3000 }; t1.Tick += (o, a) => { t1.Stop(); status.Text = "Delayed"; }; var t2 = new System.Windows.Forms.Timer { Enabled = true, Interval = 3001 }; t1.Tick += (o, a) => { t1.Stop(); status.Text = "Delayed1"; }; var t3 = new System.Windows.Forms.Timer { Enabled = true, Interval = 3002 }; t3.Tick += (o, a) => { t3.Stop(); status.Text = "Delayed2"; }; backup(config); } else status.Text = "Invalid path";
Why it doesn't execute?