码迷,mamicode.com
首页 > Web开发 > 详细

NET定时任务执行管理器开源组件–FluentScheduler

时间:2017-02-26 18:55:51      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:www   csdn   htm   pre   eric   target   div   ref   collect   

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);
            }
        }
    }
}

 

NET定时任务执行管理器开源组件–FluentScheduler

标签:www   csdn   htm   pre   eric   target   div   ref   collect   

原文地址:http://www.cnblogs.com/shiningrise/p/6444988.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!