NET定时任务执行管理器开源组件–FluentScheduler
NET定时任务执行管理器开源组件–FluentScheduler
http://www.cnblogs.com/Irving/p/4053462.html
using FluentScheduler; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Registry registry = new Registry(); registry.Schedule(() => WriteDateTimeString()).WithName("WriteTimeString").ToRunNow().AndEvery(5).Seconds(); JobManager.Initialize(registry); } private void WriteDateTimeString() { SetText(DateTime.Now.ToString() + " 正在执行任务\n"); } private void SetText(string text) { if (this.richTextBox1.InvokeRequired) { Action<string> setTextCallBack = SetText; this.Invoke(setTextCallBack, new object[] { text }); } else { this.richTextBox1.AppendText(text); } } } }