Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void StartThreadButton_Click(object sender, EventArgs e)
- {
- BeginInvoke(new Action(delegate()
- {
- new TimerLol(delegate()
- {
- // update the UI here.
- });
- }));
- }
- }
- public class TimerLol
- {
- private Action callback;
- public TimerLol(Action callback)
- {
- this.callback = callback;
- }
- private void TimerLol()
- {
- while (true)
- {
- if (DateTime.Now == DateTime.Now.AddDays(1)) // futuristic!
- {
- callback();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement