public Task AddTask(string path, Trigger trigger, Action action, string UserId = null, string Password = null, TaskLogonType LogonType = (TaskLogonType)3) { var definition = NewTask(); definition.Triggers.Add(trigger); definition.Actions.Add(action); return RootFolder.RegisterTaskDefinition(path, definition, TaskCreation.CreateOrUpdate, UserId, Password, LogonType, null); }
public override void CopyProperties(Trigger sourceTrigger) { base.CopyProperties(sourceTrigger); if (sourceTrigger.GetType() == base.GetType()) { DaysOfWeek = ((WeeklyTrigger)sourceTrigger).DaysOfWeek; WeeksInterval = ((WeeklyTrigger)sourceTrigger).WeeksInterval; } }
public override void CopyProperties(Trigger sourceTrigger) { base.CopyProperties(sourceTrigger); if (sourceTrigger.GetType() == base.GetType()) { DaysOfMonth = ((MonthlyTrigger)sourceTrigger).DaysOfMonth; MonthsOfYear = ((MonthlyTrigger)sourceTrigger).MonthsOfYear; try { RunOnLastDayOfMonth = ((MonthlyTrigger)sourceTrigger).RunOnLastDayOfMonth; } catch { } } }
public virtual void CopyProperties(Trigger sourceTrigger) { Enabled = sourceTrigger.Enabled; EndBoundary = sourceTrigger.EndBoundary; try { ExecutionTimeLimit = sourceTrigger.ExecutionTimeLimit; } catch { } Repetition.Duration = sourceTrigger.Repetition.Duration; Repetition.Interval = sourceTrigger.Repetition.Interval; Repetition.StopAtDurationEnd = sourceTrigger.Repetition.StopAtDurationEnd; StartBoundary = sourceTrigger.StartBoundary; if (sourceTrigger is ITriggerDelay && this is ITriggerDelay) try { ((ITriggerDelay)this).Delay = ((ITriggerDelay)sourceTrigger).Delay; } catch { } if (sourceTrigger is ITriggerUserId && this is ITriggerUserId) try { ((ITriggerUserId)this).UserId = ((ITriggerUserId)sourceTrigger).UserId; } catch { } }