public Notifier() { InitializeComponent(); this.nextHour = DateTime.Now.DayOfYear * 24 + DateTime.Now.Hour + 1; //ResetHourSharpTimer(); WechatTimer.Start(); }
private void WechatTimer_Tick(object sender, EventArgs e) { if (this.nextHour <= DateTime.Now.DayOfYear * 24 + DateTime.Now.Hour) { if (DoScheduleTasks(this.nextHour % 24)) { this.nextHour++; } } SendMessagesToWechat(); int seconds = DateTime.Now.Second; int interval = (60 - seconds) * 1000; WechatTimer.Interval = interval; WechatTimer.Start(); }