private void t_Tick(object sender, EventArgs e) { MethodTimer t = (MethodTimer)sender; t.Stop(); t.Method.Invoke(); }
private void btnCallMeLater_Click(object sender, EventArgs e) { MethodTimer hide = new MethodTimer(hideButton); MethodTimer show = new MethodTimer(showButton); hide.Interval = 1000; show.Interval = 5000; hide.Tick += new EventHandler(t_Tick); show.Tick += new EventHandler(t_Tick); hide.Start(); show.Start(); }