我创建了一个任务调度,并设置其触发时间定如每天-5:00,但我想,当触发系统启动或启动该事件。 请帮我的代码,如果您有任何例子。
提前致谢。
代码:------------------------------------------------ ------
public static void CreateTask()
{
using (TaskService task = new TaskService())
{`enter code here`
TaskDefinition taskdDef = task.NewTask();
taskdDef.RegistrationInfo.Description = "Does something";
taskdDef.RegistrationInfo.Documentation = "http://www.mysite.com";
taskdDef.Settings.ExecutionTimeLimit = new TimeSpan(0, 10, 0);
taskdDef.Settings.AllowDemandStart = true;
taskdDef.Actions.Add(new ExecAction(@"D:\Myfolder\bin\SGSclient.exe", "yourArguments", null));
task.RootFolder.RegisterTaskDefinition("YourTask", taskdDef);
}
}