using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.Tasks;
namespace MyCompany.HelloWorld.Services
{
/// <summary>
/// 只用实现IBackgroundTask接口就可以轻松实现计划任务功能了
/// </summary>
public class HelloWorldTask : IBackgroundTask
{
private readonly ITextService _textService;
public HelloWorldTask(ITextService textService)
{
_textService = textService;
}
public void Sweep()
{
//系统会每分钟执行一次此方法
//我们可以在这里实现需要执行的内容
//我们也在这里实现执行间隔的功能
_textService.UpdateText("Hello World, The current time is:" + DateTime.Now.ToString());
}
}