8

我正在使用FluentScheduler,并且有一个注册表类,

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 分钟运行一次。

我想阻止这一切。我如何停止这个调度程序?

4

1 回答 1

9

我为时间表设置了一个名称。

Schedule(alertAction).WithName("UnreadAlertRegistry").ToRunEvery(minute).Minutes();

并停止它,使用RemoveTask

TaskManager.RemoveTask("UnreadAlertRegistry");
于 2016-02-28T05:34:43.753 回答