/// <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;
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
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");
            }
        }
 /// <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");
     }
 }
Exemplo n.º 5
0
 internal Trigger(ITaskTrigger trigger, V1Interop.TaskTriggerType type)
     : this(trigger, trigger.GetTrigger())
 {
 }
Exemplo n.º 6
0
 internal static Trigger CreateTrigger(ITaskTrigger trigger)
 {
     return(CreateTrigger(trigger, trigger.GetTrigger().Type));
 }
Exemplo n.º 7
0
 internal Trigger(ITaskTrigger trigger, V1Interop.TaskTriggerType type)
     : this(trigger, trigger.GetTrigger()) { }
Exemplo n.º 8
0
 internal static Trigger CreateTrigger(ITaskTrigger trigger) { return CreateTrigger(trigger, trigger.GetTrigger().Type); }
 public V1Trigger(ITaskTrigger trigger, TaskTriggerType type)
 {
     iTrigger         = trigger;
     triggerData      = trigger.GetTrigger();
     triggerData.Type = type;
 }
Exemplo n.º 10
0
 internal Trigger(ITaskTrigger trigger, V1.TaskTriggerType type)
 {
     v1Trigger = trigger;
     v1TriggerData = trigger.GetTrigger();
     v1TriggerData.Type = type;
     ttype = ConvertFromV1TriggerType(type);
 }