/// <summary>
        /// Overridden ProcessRecord method.
        /// </summary>
        protected override void ProcessRecord()
        {
            if (Objects == null || Objects.Length == 0)
            {
                throw new ArgumentException("Must specify at least one object to wait on.");
            }

            NtWaitTimeout timeout = null;

            if (Infinite)
            {
                timeout = NtWaitTimeout.Infinite;
            }
            else
            {
                long total_timeout = MilliSeconds + ((((Hours * 60L) + Minutes) * 60L) + Seconds) * 1000L;
                if (total_timeout < 0)
                {
                    throw new ArgumentException("Total timeout can't be negative.");
                }

                timeout = NtWaitTimeout.FromMilliseconds(total_timeout);
            }

            if (Objects.Length == 1)
            {
                WriteObject(Objects[0].Wait(Alertable, timeout));
            }
            else
            {
                WriteObject(NtWait.Wait(Objects, Alertable, WaitAll, timeout));
            }
        }
Пример #2
0
        /// <summary>
        /// Overridden ProcessRecord method.
        /// </summary>
        protected override void ProcessRecord()
        {
            if (Objects == null || Objects.Length == 0)
            {
                throw new ArgumentException("Must specify at least one object to wait on.");
            }

            NtWaitTimeout timeout = GetTimeout();

            if (Objects.Length == 1)
            {
                WriteObject(Objects[0].Wait(Alertable, timeout));
            }
            else
            {
                WriteObject(NtWait.Wait(Objects, Alertable, WaitAll, timeout));
            }
        }