Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: DeleteExpiredTaskAfter?

$
0
0
Hey ho all ...
first of all, i'm new in c# and my english is very poor :(

So now my question ..
I'm creating a Task with the following Code
td.RegistrationInfo.Description = " Some Text which describes my task";
td.Principal.LogonType = TaskLogonType.InteractiveToken;

TimeTrigger tt = new TimeTrigger();
DateTime d1 = DateTime.Now;
DateTime d2 = d1.AddHours(2);
TimeSpan interval = d2 - d1;

tt.StartBoundary = d1;
tt.EndBoundary = d2.AddDays(1);
td.Triggers.Add(tt);
td.Settings.DisAllowStartIfOnBatteries = false;
td.Settings.DeleteExpiredTasksAfter = interval;


td.Actions.Add(new ExecAction("Notepad",null));

ts.RootFolder.RegisterTaskDefinition(@"Definition Example", td, TaskCreation.Create, HttpContext.Current.User.Identity.Name, null);
Now my Task will be created but there is a issue with the Expiration Time / NextRunTIme
The Task will be created like the following example:
Name = "Example"
Status = "Ready"
Triggers = At 10:36 on 04.06.2013 - Trigger expires at 05.06.2013 12:36:00
Next RunTime = "05.06.2013 14:36:00"

How can i set the Next Runtime correct?
In my Scenario i think the next Runtime should be set to 04.06.2013 10.36.00 and not to the next day 2 hours after the expiration ...
Any Hint? Tips? Tricks?

Kind regards,
Kai

Viewing all articles
Browse latest Browse all 2206

Trending Articles