Hey there,
First of all, thanks for making this Wrapper. It's amazing.
I need to change desktop background every day based on time user picks. If machine is not working I need this task to start after user logs on at some point.
This is the code that I have at the moment :
How can I set "StartWhenAvailable" checkbox marked through the code ?
I did check Discussions and only found one topic which covered this question, but it doesn't apply to me as I tried already to set RestartInterval to TimeInterval.Zero. I need this task to be infinite, so I'm not sure how would I set EndBoundry in that case ?
Thanks,
S. M.
First of all, thanks for making this Wrapper. It's amazing.
I need to change desktop background every day based on time user picks. If machine is not working I need this task to start after user logs on at some point.
This is the code that I have at the moment :
using (TaskService taskSer = new TaskService())
{
TaskDefinition td = taskSer.NewTask();
DailyTrigger dt = new DailyTrigger();
dt.StartBoundary = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, startHour.Hours, startHour.Minutes, startHour.Seconds);
taskSer.AddTask("Task", dt, new ExecAction(execPath));
td.Settings.StartWhenAvailable = true;
td.Settings.Compatibility = TaskCompatibility.V2_3;
td.Settings.RestartInterval = TimeSpan.Zero;
}
However, when I go to Task Scheduler, Settings tab, checkbox for starting the task after missing it, is not checked.How can I set "StartWhenAvailable" checkbox marked through the code ?
I did check Discussions and only found one topic which covered this question, but it doesn't apply to me as I tried already to set RestartInterval to TimeInterval.Zero. I need this task to be infinite, so I'm not sure how would I set EndBoundry in that case ?
Thanks,
S. M.