[英]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 我正在使用C#Task Scheduler库来管理任务: https : //github.com/dahall/TaskScheduler
On a given task, I can set the "Enabled" boolean and persist the changes: 对于给定的任务,我可以设置“ Enabled”布尔值并保留更改:
task.Enabled= true;
task.State.Dump();
task.RegisterChanges();
But the call to RegisterChanges() does not result in a change. 但是对RegisterChanges()的调用不会导致更改。 Am I missing something?
我想念什么吗? Is there some other way to disable a task using this library?
还有其他方法可以使用此库禁用任务吗?
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! github上的开源非常有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.