How to stop the FluentScheduler task?

I use FluentSchedulerand have a registry 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();
     }
  }

and in the application, I initialize it.

alert = new UnreadAlertRegistry(5, _dashboardUser, false);
TaskManager.Initialize(alert);

It starts every 5 minutes.

I want to stop this. How to stop this scheduler?

+4
source share
1 answer

I set a name for the schedule.

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

and to stop use RemoveTask

TaskManager.RemoveTask("UnreadAlertRegistry");
+5
source

All Articles