Exemple #1
0
        // Constructors
        public TaskSetting(string taskSettingId, string taskSettingName, ITaskTrigger taskTrigger, ITaskAction taskAction)
        {
            #region Contracts

            if (string.IsNullOrEmpty(taskSettingName) == true)
            {
                throw new ArgumentNullException();
            }
            if (taskTrigger == null)
            {
                throw new ArgumentNullException();
            }
            if (taskAction == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Arguments
            this.TaskSettingId   = taskSettingId;
            this.TaskSettingName = taskSettingName;
            this.TaskTrigger     = taskTrigger;
            this.TaskAction      = taskAction;
        }
 public virtual void Dispose()
 {
     if (iTrigger != null)
     {
         Marshal.ReleaseComObject(iTrigger);
         iTrigger = null;
     }
 }
Exemple #3
0
 /// <summary>
 /// Break the connection between this Trigger and the system Task Scheduler.  This
 /// releases COM resources used in bound Triggers.
 /// </summary>
 internal void Unbind()
 {
     if (iTaskTrigger != null)
     {
         Marshal.ReleaseComObject(iTaskTrigger);
         iTaskTrigger = null;
     }
 }
Exemple #4
0
 internal virtual void Bind(ITask iTask)
 {
     if (_v1Trigger == null)
     {
         ushort num;
         _v1Trigger = iTask.CreateTrigger(out num);
     }
     SetV1TriggerData();
 }
Exemple #5
0
 /// <summary>
 /// Internal base constructor for an unbound Trigger.
 /// </summary>
 internal Trigger()
 {
     iTaskTrigger            = null;
     taskTrigger             = new TaskTrigger();
     taskTrigger.TriggerSize = (ushort)Marshal.SizeOf(taskTrigger);
     taskTrigger.BeginYear   = (ushort)DateTime.Today.Year;
     taskTrigger.BeginMonth  = (ushort)DateTime.Today.Month;
     taskTrigger.BeginDay    = (ushort)DateTime.Today.Day;
 }
Exemple #6
0
 /// <summary>
 /// Bind a Trigger object to an ITaskTrigger interface.  This causes the Trigger to
 /// sync itself with the interface and remain in sync whenever it is modified in the future.
 /// If the Trigger is already bound, an ArgumentException is thrown.
 /// </summary>
 /// <param name="iTaskTrigger">An interface representing a trigger in Task Scheduler.</param>
 /// <exception cref="ArgumentException">Attempt to bind and already bound trigger.</exception>
 internal void Bind(ITaskTrigger iTaskTrigger)
 {
     if (this.iTaskTrigger != null)
     {
         throw new ArgumentException("Attempt to bind an already bound trigger");
     }
     this.iTaskTrigger = iTaskTrigger;
     iTaskTrigger.SetTrigger(ref taskTrigger);
 }
 /// <summary>
 /// Internal base constructor for an unbound Trigger.
 /// </summary>
 internal Trigger()
 {
     iTaskTrigger = null;
     taskTrigger = new TaskTrigger();
     taskTrigger.TriggerSize = (ushort)Marshal.SizeOf(taskTrigger);
     taskTrigger.BeginYear = (ushort)DateTime.Today.Year;
     taskTrigger.BeginMonth = (ushort)DateTime.Today.Month;
     taskTrigger.BeginDay = (ushort)DateTime.Today.Day;
 }
Exemple #8
0
 internal virtual void Bind(ITask iTask)
 {
     if (_v1Trigger == null)
     {
         ushort num;
         _v1Trigger = iTask.CreateTrigger(out num);
     }
     SetV1TriggerData();
 }
 /// <summary>
 /// Internal constructor which initializes itself from
 /// from an ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">Instance of ITaskTrigger from system task scheduler.</param>
 internal Trigger(ITaskTrigger iTrigger)
 {
     if (iTrigger == null)
         throw new ArgumentNullException("iTrigger", "ITaskTrigger instance cannot be null");
     taskTrigger = new TaskTrigger();
     taskTrigger.TriggerSize = (ushort)Marshal.SizeOf(taskTrigger);
     iTrigger.GetTrigger(ref taskTrigger);
     iTaskTrigger = iTrigger;
 }
        /// <summary>
        /// Gets the default triggers.
        /// </summary>
        /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
        public IEnumerable<ITaskTrigger> GetDefaultTriggers()
        {
            var list = new ITaskTrigger[] { 

                new IntervalTrigger{ Interval = TimeSpan.FromHours(12)}

            }.ToList();

            return list;
        }
        /// <summary>
        /// Gets the default triggers.
        /// </summary>
        /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
        public IEnumerable <ITaskTrigger> GetDefaultTriggers()
        {
            var list = new ITaskTrigger[] {
                new IntervalTrigger {
                    Interval = TimeSpan.FromHours(12)
                }
            }.ToList();

            return(list);
        }
Exemple #12
0
 /// <summary>
 /// Internal constructor which initializes itself from
 /// from an ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">Instance of ITaskTrigger from system task scheduler.</param>
 internal Trigger(ITaskTrigger iTrigger)
 {
     if (iTrigger == null)
     {
         throw new ArgumentNullException("iTrigger", "ITaskTrigger instance cannot be null");
     }
     taskTrigger             = new TaskTrigger();
     taskTrigger.TriggerSize = (ushort)Marshal.SizeOf(taskTrigger);
     iTrigger.GetTrigger(ref taskTrigger);
     iTaskTrigger = iTrigger;
 }
Exemple #13
0
        // Concat
        public static ITaskTrigger Concat(this ITaskTrigger firstTrigger, ITaskTrigger secondTrigger)
        {
            #region Contracts

            if (firstTrigger == null) throw new ArgumentNullException();
            if (secondTrigger == null) throw new ArgumentNullException();

            #endregion

            // Return
            return new ConcatTrigger(firstTrigger, secondTrigger);
        }
Exemple #14
0
        // Constructors
        public ConcatTrigger(ITaskTrigger firstTrigger, ITaskTrigger secondTrigger)
        {
            #region Contracts

            if (firstTrigger == null) throw new ArgumentNullException();
            if (secondTrigger == null) throw new ArgumentNullException();

            #endregion

            // Arguments
            _firstTrigger = firstTrigger;
            _secondTrigger = secondTrigger;
        }
Exemple #15
0
        /// <summary>
        /// Gets the default triggers.
        /// </summary>
        /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
        public IEnumerable <ITaskTrigger> GetDefaultTriggers()
        {
            var list = new ITaskTrigger[] {
                new IntervalTrigger {
                    Interval = TimeSpan.FromHours(12)
                }
            }.ToList();

            if (!_config.Configuration.DisableStartupScan)
            {
                list.Add(new StartupTrigger());
            }

            return(list);
        }
        /// <summary>
        /// Gets the default triggers.
        /// </summary>
        /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
        public IEnumerable<ITaskTrigger> GetDefaultTriggers()
        {
            var list = new ITaskTrigger[] { 

                new IntervalTrigger{ Interval = TimeSpan.FromHours(12)}

            }.ToList();

            if (!_config.Configuration.DisableStartupScan)
            {
                list.Add(new StartupTrigger());
            }

            return list;
        }
Exemple #17
0
        // Constructors
        public TaskSetting(string taskSettingId, string taskSettingName, ITaskTrigger taskTrigger, ITaskAction taskAction)
        {
            #region Contracts

            if (string.IsNullOrEmpty(taskSettingName) == true) throw new ArgumentNullException();
            if (taskTrigger == null) throw new ArgumentNullException();
            if (taskAction == null) throw new ArgumentNullException();

            #endregion

            // Arguments
            this.TaskSettingId = taskSettingId;
            this.TaskSettingName = taskSettingName;
            this.TaskTrigger = taskTrigger;
            this.TaskAction = taskAction;
        }
Exemple #18
0
 public static TaskResult Execute(this ITaskTrigger job, Func <TaskResult> action,
                                  double timeoutInMilliseconds, CancellationToken token)
 {
     try
     {
         SystemTasks.Task.Delay(TimeSpan.FromMilliseconds(timeoutInMilliseconds), token).Wait(token);
         if (token.IsCancellationRequested)
         {
             return(TaskResult.Aborted);
         }
         return(action());
     }
     catch (Exception e)
     {
         return(TaskResult.Aborted);
     }
 }
Exemple #19
0
        // Concat
        public static ITaskTrigger Concat(this ITaskTrigger firstTrigger, ITaskTrigger secondTrigger)
        {
            #region Contracts

            if (firstTrigger == null)
            {
                throw new ArgumentNullException();
            }
            if (secondTrigger == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Return
            return(new ConcatTrigger(firstTrigger, secondTrigger));
        }
Exemple #20
0
        // Constructors
        public ConcatTrigger(ITaskTrigger firstTrigger, ITaskTrigger secondTrigger)
        {
            #region Contracts

            if (firstTrigger == null)
            {
                throw new ArgumentNullException();
            }
            if (secondTrigger == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Arguments
            _firstTrigger  = firstTrigger;
            _secondTrigger = secondTrigger;
        }
        /// <summary>
        /// Gets the trigger info.
        /// </summary>
        /// <param name="trigger">The trigger.</param>
        /// <returns>TaskTriggerInfo.</returns>
        public static TaskTriggerInfo GetTriggerInfo(ITaskTrigger trigger)
        {
            var info = new TaskTriggerInfo
            {
                Type = trigger.GetType().Name
            };

            var dailyTrigger = trigger as DailyTrigger;

            if (dailyTrigger != null)
            {
                info.TimeOfDayTicks = dailyTrigger.TimeOfDay.Ticks;
            }

            var weeklyTaskTrigger = trigger as WeeklyTrigger;

            if (weeklyTaskTrigger != null)
            {
                info.TimeOfDayTicks = weeklyTaskTrigger.TimeOfDay.Ticks;
                info.DayOfWeek = weeklyTaskTrigger.DayOfWeek;
            }

            var intervalTaskTrigger = trigger as IntervalTrigger;

            if (intervalTaskTrigger != null)
            {
                info.IntervalTicks = intervalTaskTrigger.Interval.Ticks;
            }

            var systemEventTrigger = trigger as SystemEventTrigger;

            if (systemEventTrigger != null)
            {
                info.SystemEvent = systemEventTrigger.SystemEvent;
            }

            if (trigger.TaskOptions != null)
            {
                info.MaxRuntimeMs = trigger.TaskOptions.MaxRuntimeMs;
            }

            return info;
        }
        /// <summary>
        /// Gets the trigger info.
        /// </summary>
        /// <param name="trigger">The trigger.</param>
        /// <returns>TaskTriggerInfo.</returns>
        public static TaskTriggerInfo GetTriggerInfo(ITaskTrigger trigger)
        {
            var info = new TaskTriggerInfo
            {
                Type = trigger.GetType().Name
            };

            var dailyTrigger = trigger as DailyTrigger;

            if (dailyTrigger != null)
            {
                info.TimeOfDayTicks = dailyTrigger.TimeOfDay.Ticks;
            }

            var weeklyTaskTrigger = trigger as WeeklyTrigger;

            if (weeklyTaskTrigger != null)
            {
                info.TimeOfDayTicks = weeklyTaskTrigger.TimeOfDay.Ticks;
                info.DayOfWeek      = weeklyTaskTrigger.DayOfWeek;
            }

            var intervalTaskTrigger = trigger as IntervalTrigger;

            if (intervalTaskTrigger != null)
            {
                info.IntervalTicks = intervalTaskTrigger.Interval.Ticks;
            }

            var systemEventTrigger = trigger as SystemEventTrigger;

            if (systemEventTrigger != null)
            {
                info.SystemEvent = systemEventTrigger.SystemEvent;
            }

            if (trigger.TaskOptions != null)
            {
                info.MaxRuntimeMs = trigger.TaskOptions.MaxRuntimeMs;
            }

            return(info);
        }
Exemple #23
0
        /// <summary>
        /// Creates a new, bound Trigger object from an ITaskTrigger interface.  The type of the
        /// concrete object created is determined by the type of ITaskTrigger.
        /// </summary>
        /// <param name="iTaskTrigger">Instance of ITaskTrigger.</param>
        /// <returns>One of the concrete classes derived from Trigger.</returns>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="ArgumentException">Unable to recognize trigger type.</exception>
        internal static Trigger CreateTrigger(ITaskTrigger iTaskTrigger)
        {
            if (iTaskTrigger == null)
            {
                throw new ArgumentNullException("iTaskTrigger", "Instance of ITaskTrigger cannot be null");
            }
            TaskTrigger sTaskTrigger = new TaskTrigger();

            sTaskTrigger.TriggerSize = (ushort)Marshal.SizeOf(sTaskTrigger);
            iTaskTrigger.GetTrigger(ref sTaskTrigger);
            switch ((TriggerType)sTaskTrigger.Type)
            {
            case TriggerType.RunOnce:
                return(new RunOnceTrigger(iTaskTrigger));

            case TriggerType.RunDaily:
                return(new DailyTrigger(iTaskTrigger));

            case TriggerType.RunWeekly:
                return(new WeeklyTrigger(iTaskTrigger));

            case TriggerType.RunMonthlyDOW:
                return(new MonthlyDOWTrigger(iTaskTrigger));

            case TriggerType.RunMonthly:
                return(new MonthlyTrigger(iTaskTrigger));

            case TriggerType.OnIdle:
                return(new OnIdleTrigger(iTaskTrigger));

            case TriggerType.OnSystemStart:
                return(new OnSystemStartTrigger(iTaskTrigger));

            case TriggerType.OnLogon:
                return(new OnLogonTrigger(iTaskTrigger));

            default:
                throw new ArgumentException("Unable to recognize type of trigger referenced in iTaskTrigger",
                                            "iTaskTrigger");
            }
        }
Exemple #24
0
        internal static Trigger CreateTrigger(ITaskTrigger trigger, V1Interop.TaskTriggerType triggerType)
        {
            switch (triggerType)
            {
            case V1Interop.TaskTriggerType.RunOnce: return(new TimeTrigger(trigger));

            case V1Interop.TaskTriggerType.RunDaily: return(new DailyTrigger(trigger));

            case V1Interop.TaskTriggerType.RunWeekly: return(new WeeklyTrigger(trigger));

            case V1Interop.TaskTriggerType.RunMonthly: return(new MonthlyTrigger(trigger));

            case V1Interop.TaskTriggerType.RunMonthlyDOW: return(new MonthlyDOWTrigger(trigger));

            case V1Interop.TaskTriggerType.OnIdle: return(new IdleTrigger(trigger));

            case V1Interop.TaskTriggerType.OnSystemStart: return(new BootTrigger(trigger));

            case V1Interop.TaskTriggerType.OnLogon: return(new LogonTrigger(trigger));
            }
            return(null);
        }
Exemple #25
0
 internal BootTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, TaskTriggerType.OnSystemStart) { }
Exemple #26
0
 internal static Trigger CreateTrigger(ITaskTrigger trigger) { return CreateTrigger(trigger, trigger.GetTrigger().Type); }
 internal BootTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, TaskTriggerType.OnSystemStart)
 {
 }
		/// <summary>
		/// Internal constructor from ITaskTrigger interface.
		/// </summary>
		/// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
		internal StartableTrigger(ITaskTrigger iTrigger) : base(iTrigger) {
		}
Exemple #29
0
 internal IdleTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, TaskTriggerType.OnIdle) { }
Exemple #30
0
 internal MonthlyTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, TaskTriggerType.RunMonthly)
 {
 }
Exemple #31
0
 public WorkTask(string name, ITask task, ITaskTrigger taskTrigger)
 {
     this.Name        = name;
     this.TaskTrigger = taskTrigger;
     this.Task        = task;
 }
Exemple #32
0
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
 internal RunOnceTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
Exemple #33
0
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger interface from system Task Scheduler.</param>
 internal WeeklyTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger interface from system Task Scheduler.</param>
 internal OnSystemStartTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
Exemple #35
0
 internal Trigger(ITaskTrigger trigger, TaskTrigger data)
 {
     _v1Trigger = trigger;
     _v1TriggerData = data;
     _ttype = ConvertFromV1TriggerType(data.Type);
 }
		/// <summary>
		/// Internal constructor to create from existing ITaskTrigger interface.
		/// </summary>
		/// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
		internal MonthlyTrigger(ITaskTrigger iTrigger) : base(iTrigger) {
		}
		/// <summary>
		/// Internal constructor to create from existing ITaskTrigger interface.
		/// </summary>
		/// <param name="iTrigger">ITaskTrigger interface from system Task Scheduler.</param>
		internal WeeklyTrigger(ITaskTrigger iTrigger) : base(iTrigger) {
		}
		/// <summary>
		/// Internal constructor to create from existing ITaskTrigger interface.
		/// </summary>
		/// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
		internal RunOnceTrigger(ITaskTrigger iTrigger) : base(iTrigger) {
		}
Exemple #39
0
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger interface from system Task Scheduler.</param>
 internal OnSystemStartTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
Exemple #40
0
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">Current base Trigger.</param>
 internal OnIdleTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
Exemple #41
0
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
 internal OnLogonTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
 /// <summary>
 /// Bind a Trigger object to an ITaskTrigger interface.  This causes the Trigger to
 /// sync itself with the interface and remain in sync whenever it is modified in the future.
 /// If the Trigger is already bound, an ArgumentException is thrown.
 /// </summary>
 /// <param name="iTaskTrigger">An interface representing a trigger in Task Scheduler.</param>
 /// <exception cref="ArgumentException">Attempt to bind and already bound trigger.</exception>
 internal void Bind(ITaskTrigger iTaskTrigger)
 {
     if (this.iTaskTrigger != null)
         throw new ArgumentException("Attempt to bind an already bound trigger");
     this.iTaskTrigger = iTaskTrigger;
     iTaskTrigger.SetTrigger(ref taskTrigger);
 }
Exemple #43
0
 internal MonthlyDOWTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, V1.TaskTriggerType.RunMonthlyDOW)
 {
 }
Exemple #44
0
 internal static Trigger CreateTrigger(ITaskTrigger trigger, V1Interop.TaskTriggerType triggerType)
 {
     switch (triggerType)
     {
         case V1Interop.TaskTriggerType.RunOnce: return new TimeTrigger(trigger);
         case V1Interop.TaskTriggerType.RunDaily: return new DailyTrigger(trigger);
         case V1Interop.TaskTriggerType.RunWeekly: return new WeeklyTrigger(trigger);
         case V1Interop.TaskTriggerType.RunMonthly: return new MonthlyTrigger(trigger);
         case V1Interop.TaskTriggerType.RunMonthlyDOW: return new MonthlyDOWTrigger(trigger);
         case V1Interop.TaskTriggerType.OnIdle: return new IdleTrigger(trigger);
         case V1Interop.TaskTriggerType.OnSystemStart: return new BootTrigger(trigger);
         case V1Interop.TaskTriggerType.OnLogon: return new LogonTrigger(trigger);
     }
     return null;
 }
 internal LogonTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, TaskTriggerType.OnLogon)
 {
 }
Exemple #46
0
 internal Trigger(ITaskTrigger trigger, V1Interop.TaskTriggerType type)
     : this(trigger, trigger.GetTrigger()) { }
Exemple #47
0
 /// <summary>
 /// Internal constructor from ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
 internal StartableTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
 internal DailyTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
Exemple #49
0
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
 internal DailyTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
Exemple #50
0
 internal static Trigger CreateTrigger(ITaskTrigger trigger)
 {
     return(CreateTrigger(trigger, trigger.GetTrigger().Type));
 }
Exemple #51
0
 /// <summary>
 /// Internal constructor to create from existing ITaskTrigger interface.
 /// </summary>
 /// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
 internal MonthlyTrigger(ITaskTrigger iTrigger) : base(iTrigger)
 {
 }
Exemple #52
0
 internal Trigger(ITaskTrigger trigger, TaskTrigger data)
 {
     _v1Trigger     = trigger;
     _v1TriggerData = data;
     _ttype         = ConvertFromV1TriggerType(data.Type);
 }
 /// <summary>
 /// Creates a new, bound Trigger object from an ITaskTrigger interface.  The type of the
 /// concrete object created is determined by the type of ITaskTrigger.
 /// </summary>
 /// <param name="iTaskTrigger">Instance of ITaskTrigger.</param>
 /// <returns>One of the concrete classes derived from Trigger.</returns>
 /// <exception cref="ArgumentNullException"></exception>
 /// <exception cref="ArgumentException">Unable to recognize trigger type.</exception>
 internal static Trigger CreateTrigger(ITaskTrigger iTaskTrigger)
 {
     if (iTaskTrigger == null)
         throw new ArgumentNullException("iTaskTrigger", "Instance of ITaskTrigger cannot be null");
     TaskTrigger sTaskTrigger = new TaskTrigger();
     sTaskTrigger.TriggerSize = (ushort)Marshal.SizeOf(sTaskTrigger);
     iTaskTrigger.GetTrigger(ref sTaskTrigger);
     switch ((TriggerType)sTaskTrigger.Type)
     {
         case TriggerType.RunOnce:
             return new RunOnceTrigger(iTaskTrigger);
         case TriggerType.RunDaily:
             return new DailyTrigger(iTaskTrigger);
         case TriggerType.RunWeekly:
             return new WeeklyTrigger(iTaskTrigger);
         case TriggerType.RunMonthlyDOW:
             return new MonthlyDowTrigger(iTaskTrigger);
         case TriggerType.RunMonthly:
             return new MonthlyTrigger(iTaskTrigger);
         case TriggerType.OnIdle:
             return new OnIdleTrigger(iTaskTrigger);
         case TriggerType.OnSystemStart:
             return new OnSystemStartTrigger(iTaskTrigger);
         case TriggerType.OnLogon:
             return new OnLogonTrigger(iTaskTrigger);
         default:
             throw new ArgumentException("Unable to recognize type of trigger referenced in iTaskTrigger",
                                         "iTaskTrigger");
     }
 }
Exemple #54
0
 internal Trigger(ITaskTrigger trigger, V1Interop.TaskTriggerType type)
     : this(trigger, trigger.GetTrigger())
 {
 }
 /// <summary>
 /// Break the connection between this Trigger and the system Task Scheduler.  This
 /// releases COM resources used in bound Triggers.
 /// </summary>
 internal void Unbind()
 {
     if (iTaskTrigger != null)
     {
         Marshal.ReleaseComObject(iTaskTrigger);
         iTaskTrigger = null;
     }
 }
Exemple #56
0
 internal WeeklyTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, V1Interop.TaskTriggerType.RunWeekly) { }
		/// <summary>
		/// Internal constructor to create from existing ITaskTrigger interface.
		/// </summary>
		/// <param name="iTrigger">Current base Trigger.</param>
		internal OnIdleTrigger(ITaskTrigger iTrigger) : base(iTrigger) {
		}
Exemple #58
0
 public SchedulerTask(ITaskTrigger taskTrigger, Func<bool> command)
 {
     _taskTrigger = taskTrigger;
     _command = command;
 }
Exemple #59
0
 internal MonthlyTrigger(ITaskTrigger iTrigger)
     : base(iTrigger, TaskTriggerType.RunMonthly) { }
		/// <summary>
		/// Internal constructor to create from existing ITaskTrigger interface.
		/// </summary>
		/// <param name="iTrigger">ITaskTrigger from system Task Scheduler.</param>
		internal OnLogonTrigger(ITaskTrigger iTrigger) : base(iTrigger) {
		}