mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-28 10:56:37 +08:00
36 lines
929 B
C#
36 lines
929 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Util.Dependency;
|
|
using Util.Schedulers.Quartz;
|
|
|
|
namespace Util.Samples.Schedulers {
|
|
public class Program {
|
|
/// <summary>
|
|
/// 入口
|
|
/// </summary>
|
|
public static void Main( string[] args ) {
|
|
Console.WriteLine( "调度器测试启动" );
|
|
Bootstrapper.Run();
|
|
Run().GetAwaiter().GetResult();
|
|
Console.ReadKey();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 运行调度器
|
|
/// </summary>
|
|
private static async Task Run() {
|
|
var scheduler = new Scheduler();
|
|
|
|
//手工添加任务
|
|
//await scheduler.AddJobAsync<TestJob1>();
|
|
//await scheduler.AddJobAsync<TestJob2>();
|
|
|
|
//扫描添加任务
|
|
await scheduler.ScanJobsAsync();
|
|
|
|
//启动调度器
|
|
await scheduler.StartAsync();
|
|
}
|
|
}
|
|
}
|