initial commit
This commit is contained in:
12
Demo/Demo.csproj
Normal file
12
Demo/Demo.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net48;net6.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\src\CronTimer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
22
Demo/Program.cs
Normal file
22
Demo/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace Demo
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
var expression = "0-30/5 * * * * *";
|
||||
Console.WriteLine(expression);
|
||||
var timer = new CronTimer(expression, "Asia/Hong_Kong", includingSeconds: true);
|
||||
timer.OnOccurence += (s, ea) => Console.WriteLine($"{ea.At:T} - {DateTime.Now}");
|
||||
timer.Start();
|
||||
|
||||
while (Console.ReadKey().Key != ConsoleKey.Escape)
|
||||
{
|
||||
}
|
||||
|
||||
timer.Stop();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user