/// <summary> /// Constructor. /// </summary> /// <param name="startIfOnBatteries"></param> /// <param name="stopIfGoingOnBatters"></param> /// <param name="wakeToRun"></param> /// <param name="startIfNotIdle"></param> /// <param name="stopIfGoingOffIdle"></param> /// <param name="restartOnIdleResume"></param> /// <param name="idleDuration"></param> /// <param name="idleTimeout"></param> /// <param name="showInTaskScheduler"></param> /// <param name="runElevated"></param> /// <param name="runWithoutNetwork"></param> /// <param name="donotAllowDemandStart"></param> /// <param name="multipleInstancePolicy"></param> internal ScheduledJobOptions( bool startIfOnBatteries, bool stopIfGoingOnBatters, bool wakeToRun, bool startIfNotIdle, bool stopIfGoingOffIdle, bool restartOnIdleResume, TimeSpan idleDuration, TimeSpan idleTimeout, bool showInTaskScheduler, bool runElevated, bool runWithoutNetwork, bool donotAllowDemandStart, TaskMultipleInstancePolicy multipleInstancePolicy) { _startIfOnBatteries = startIfOnBatteries; _stopIfGoingOnBatteries = stopIfGoingOnBatters; _wakeToRun = wakeToRun; _startIfNotIdle = startIfNotIdle; _stopIfGoingOffIdle = stopIfGoingOffIdle; _restartOnIdleResume = restartOnIdleResume; _idleDuration = idleDuration; _idleTimeout = idleTimeout; _showInTaskScheduler = showInTaskScheduler; _runElevated = runElevated; _runWithoutNetwork = runWithoutNetwork; _donotAllowDemandStart = donotAllowDemandStart; _multipleInstancePolicy = multipleInstancePolicy; }
private ScheduledJobOptions( SerializationInfo info, StreamingContext context) { if (info == null) { throw new PSArgumentNullException("info"); } _startIfOnBatteries = info.GetBoolean("StartIfOnBatteries_Value"); _stopIfGoingOnBatteries = info.GetBoolean("StopIfGoingOnBatteries_Value"); _wakeToRun = info.GetBoolean("WakeToRun_Value"); _startIfNotIdle = info.GetBoolean("StartIfNotIdle_Value"); _stopIfGoingOffIdle = info.GetBoolean("StopIfGoingOffIdle_Value"); _restartOnIdleResume = info.GetBoolean("RestartOnIdleResume_Value"); _idleDuration = (TimeSpan)info.GetValue("IdleDuration_Value", typeof(TimeSpan)); _idleTimeout = (TimeSpan)info.GetValue("IdleTimeout_Value", typeof(TimeSpan)); _showInTaskScheduler = info.GetBoolean("ShowInTaskScheduler_Value"); _runElevated = info.GetBoolean("RunElevated_Value"); _runWithoutNetwork = info.GetBoolean("RunWithoutNetwork_Value"); _donotAllowDemandStart = info.GetBoolean("DoNotAllowDemandStart_Value"); _multipleInstancePolicy = (TaskMultipleInstancePolicy)info.GetValue("TaskMultipleInstancePolicy_Value", typeof(TaskMultipleInstancePolicy)); // Runtime reference and not saved to store. _jobDefAssociation = null; }
internal ScheduledJobOptions(ScheduledJobOptions copyOptions) { if (copyOptions != null) { this._startIfOnBatteries = copyOptions.StartIfOnBatteries; this._stopIfGoingOnBatteries = copyOptions.StopIfGoingOnBatteries; this._wakeToRun = copyOptions.WakeToRun; this._startIfNotIdle = copyOptions.StartIfNotIdle; this._stopIfGoingOffIdle = copyOptions.StopIfGoingOffIdle; this._restartOnIdleResume = copyOptions.RestartOnIdleResume; this._idleDuration = copyOptions.IdleDuration; this._idleTimeout = copyOptions.IdleTimeout; this._showInTaskScheduler = copyOptions.ShowInTaskScheduler; this._runElevated = copyOptions.RunElevated; this._runWithoutNetwork = copyOptions.RunWithoutNetwork; this._donotAllowDemandStart = copyOptions.DoNotAllowDemandStart; this._multipleInstancePolicy = copyOptions.MultipleInstancePolicy; this._jobDefAssociation = copyOptions.JobDefinition; return; } else { throw new PSArgumentNullException("copyOptions"); } }
private _TASK_INSTANCES_POLICY ConvertFromMultiInstances(TaskMultipleInstancePolicy jobPolicies) { TaskMultipleInstancePolicy taskMultipleInstancePolicy = jobPolicies; switch (taskMultipleInstancePolicy) { case TaskMultipleInstancePolicy.IgnoreNew: { return(_TASK_INSTANCES_POLICY.TASK_INSTANCES_IGNORE_NEW); } case TaskMultipleInstancePolicy.Parallel: { return(_TASK_INSTANCES_POLICY.TASK_INSTANCES_PARALLEL); } case TaskMultipleInstancePolicy.Queue: { return(_TASK_INSTANCES_POLICY.TASK_INSTANCES_QUEUE); } case TaskMultipleInstancePolicy.StopExisting: { return(_TASK_INSTANCES_POLICY.TASK_INSTANCES_STOP_EXISTING); } } return(_TASK_INSTANCES_POLICY.TASK_INSTANCES_IGNORE_NEW); }
/// <summary> /// Default constructor. /// </summary> public ScheduledJobOptions() { _startIfOnBatteries = false; _stopIfGoingOnBatteries = true; _wakeToRun = false; _startIfNotIdle = true; _stopIfGoingOffIdle = false; _restartOnIdleResume = false; _idleDuration = new TimeSpan(0, 10, 0); _idleTimeout = new TimeSpan(1, 0, 0); _showInTaskScheduler = true; _runElevated = false; _runWithoutNetwork = true; _donotAllowDemandStart = false; _multipleInstancePolicy = TaskMultipleInstancePolicy.IgnoreNew; }
protected ScheduledJobOptionCmdletBase() { this._runElevated = false; this._hideInTaskScheduler = false; this._restartOnIdleResume = false; this._multipleInstancePolicy = TaskMultipleInstancePolicy.IgnoreNew; this._doNotAllowDemandStart = false; this._requireNetwork = false; this._stopIfGoingOffIdle = false; this._wakeToRun = false; this._continueIfGoingOnBattery = false; this._startIfOnBattery = false; this._idleTimeout = new TimeSpan(1, 0, 0); this._idleDuration = new TimeSpan(0, 10, 0); this._startIfIdle = false; }
private _TASK_INSTANCES_POLICY ConvertFromMultiInstances( TaskMultipleInstancePolicy jobPolicies) { switch (jobPolicies) { case TaskMultipleInstancePolicy.IgnoreNew: return _TASK_INSTANCES_POLICY.TASK_INSTANCES_IGNORE_NEW; case TaskMultipleInstancePolicy.Parallel: return _TASK_INSTANCES_POLICY.TASK_INSTANCES_PARALLEL; case TaskMultipleInstancePolicy.Queue: return _TASK_INSTANCES_POLICY.TASK_INSTANCES_QUEUE; case TaskMultipleInstancePolicy.StopExisting: return _TASK_INSTANCES_POLICY.TASK_INSTANCES_STOP_EXISTING; default: return _TASK_INSTANCES_POLICY.TASK_INSTANCES_IGNORE_NEW; } }
/// <summary> /// Copy Constructor. /// </summary> /// <param name="copyOptions">Copy from</param> internal ScheduledJobOptions( ScheduledJobOptions copyOptions) { if (copyOptions == null) { throw new PSArgumentNullException("copyOptions"); } _startIfOnBatteries = copyOptions.StartIfOnBatteries; _stopIfGoingOnBatteries = copyOptions.StopIfGoingOnBatteries; _wakeToRun = copyOptions.WakeToRun; _startIfNotIdle = copyOptions.StartIfNotIdle; _stopIfGoingOffIdle = copyOptions.StopIfGoingOffIdle; _restartOnIdleResume = copyOptions.RestartOnIdleResume; _idleDuration = copyOptions.IdleDuration; _idleTimeout = copyOptions.IdleTimeout; _showInTaskScheduler = copyOptions.ShowInTaskScheduler; _runElevated = copyOptions.RunElevated; _runWithoutNetwork = copyOptions.RunWithoutNetwork; _donotAllowDemandStart = copyOptions.DoNotAllowDemandStart; _multipleInstancePolicy = copyOptions.MultipleInstancePolicy; _jobDefAssociation = copyOptions.JobDefinition; }
private _TASK_INSTANCES_POLICY ConvertFromMultiInstances(TaskMultipleInstancePolicy jobPolicies) { TaskMultipleInstancePolicy taskMultipleInstancePolicy = jobPolicies; switch (taskMultipleInstancePolicy) { case TaskMultipleInstancePolicy.IgnoreNew: { return _TASK_INSTANCES_POLICY.TASK_INSTANCES_IGNORE_NEW; } case TaskMultipleInstancePolicy.Parallel: { return _TASK_INSTANCES_POLICY.TASK_INSTANCES_PARALLEL; } case TaskMultipleInstancePolicy.Queue: { return _TASK_INSTANCES_POLICY.TASK_INSTANCES_QUEUE; } case TaskMultipleInstancePolicy.StopExisting: { return _TASK_INSTANCES_POLICY.TASK_INSTANCES_STOP_EXISTING; } } return _TASK_INSTANCES_POLICY.TASK_INSTANCES_IGNORE_NEW; }