Пример #1
0
        /// <summary>
        /// Initializes a <c>PooledJob</c> associated to the pool specifying a user-provided target, category and sub-category.
        /// </summary>
        /// <param name="target">A <c>String</c> provided by the user that represents the target of the job.</param>
        /// <param name="category">A <c>String</c> provided by the user that represents the category of the job.</param>
        /// <param name="subCategory">A <c>String</c> provided by the user that represents the sub-category of the job.</param>
        /// <returns>A PooledJob that cannot be disassociated from the pool.</returns>
        public PooledJob CreatePooledJob(String target, String category, String subCategory)
        {
            if (String.IsNullOrEmpty(target))
                throw new ArgumentNullException("target", "The target cannot be null or empty.");

            if (String.IsNullOrEmpty(category))
                throw new ArgumentNullException("category", "The category cannot be null or empty.");

            if (String.IsNullOrEmpty(subCategory))
                throw new ArgumentNullException("subCategory", "The subCategory cannot be null or empty.");

            PowerShell ps = _GetPipeline();
            PooledJob pj = new PooledJob(ps, target, category, subCategory);
            _jobs.Add(pj.InstanceId, pj);
            return pj;
        }
Пример #2
0
 /// <summary>
 /// Initializes a <c>PooledJob</c> associated to the pool.
 /// </summary>
 /// <returns>A PooledJob that cannot be disassociated from the pool.</returns>
 public PooledJob CreatePooledJob()
 {
     PowerShell ps = _GetPipeline();
     PooledJob pj = new PooledJob(ps);
     _jobs.Add(pj.InstanceId, pj);
     return pj;
 }