如何停止 FluentScheduler 的任务?
How to stop a task of FluentScheduler?
我正在使用 FluentScheduler
,并且有一个注册表 class,
public class UnreadAlertRegistry : Registry
{
public UnreadAlertRegistry(int minute, string user, bool? type)
{
var alertAction = new Action(() =>
{
// show message box
}
Schedule(alertAction).ToRunEvery(minute).Minutes();
}
}
在应用程序中,我对其进行了初始化。
alert = new UnreadAlertRegistry(5, _dashboardUser, false);
TaskManager.Initialize(alert);
每 5 分钟 运行。
我想阻止这一切。我如何停止此调度程序?
我为日程设置了一个名称。
Schedule(alertAction).WithName("UnreadAlertRegistry").ToRunEvery(minute).Minutes();
要停止它,请使用 RemoveTask
TaskManager.RemoveTask("UnreadAlertRegistry");
我正在使用 FluentScheduler
,并且有一个注册表 class,
public class UnreadAlertRegistry : Registry
{
public UnreadAlertRegistry(int minute, string user, bool? type)
{
var alertAction = new Action(() =>
{
// show message box
}
Schedule(alertAction).ToRunEvery(minute).Minutes();
}
}
在应用程序中,我对其进行了初始化。
alert = new UnreadAlertRegistry(5, _dashboardUser, false);
TaskManager.Initialize(alert);
每 5 分钟 运行。
我想阻止这一切。我如何停止此调度程序?
我为日程设置了一个名称。
Schedule(alertAction).WithName("UnreadAlertRegistry").ToRunEvery(minute).Minutes();
要停止它,请使用 RemoveTask
TaskManager.RemoveTask("UnreadAlertRegistry");