Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use C# Task Schedule library to enable/disable a task

I'm using the C# Task Scheduler Library to manage tasks: https://github.com/dahall/TaskScheduler

On a given task, I can set the "Enabled" boolean and persist the changes:

  task.Enabled= true;
  task.State.Dump();
  task.RegisterChanges();

But the call to RegisterChanges() does not result in a change. Am I missing something? Is there some other way to disable a task using this library?

like image 207
Daniel Williams Avatar asked Feb 21 '18 17:02

Daniel Williams


People also ask

What does %c mean in C?

%d is used to print decimal(integer) number ,while %c is used to print character . If you try to print a character with %d format the computer will print the ASCII code of the character.

Where is C most used?

C is commonly used on computer architectures that range from the largest supercomputers to the smallest microcontrollers and embedded systems. A successor to the programming language B, C was originally developed at Bell Labs by Ritchie between 1972 and 1973 to construct utilities running on Unix.


1 Answers

Found it. The property to set is not the one on the task itself, but rather in the Definition Settings:

task.Definition.Settings.Enabled = true;

Open source on github is so helpful!

like image 158
Daniel Williams Avatar answered Nov 02 '22 23:11

Daniel Williams