8

I am using FluentScheduler, and 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 app, i Initialize it.

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

it is run every 5 minute.

I want to stop this. How do i stop this Scheduler?

ar.gorgin
  • 4,765
  • 12
  • 61
  • 100

1 Answers1

10

I set a Name for schedule.

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

and for stop it , use RemoveTask

TaskManager.RemoveTask("UnreadAlertRegistry");
ar.gorgin
  • 4,765
  • 12
  • 61
  • 100