コード例 #1
0
        /// <summary>
        /// checks given timeout and returns false if timeout has elapsed. sleeps for SLEEP_TIME
        /// returns true if time still available.
        /// </summary>
        /// <param name="sleep">if set to <c>true</c> [sleep].</param>
        /// <param name="machine">The machine.</param>
        /// <param name="currentCount">The current count.</param>
        /// <param name="description">optional string description</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        private bool CheckProgress(bool sleep, string machine, int currentCount, string description = null)
        {
            CDFMonitor.LogOutputHandler(string.Format("DEBUG:CheckTimer:enter:{0}:{1}:{2}", sleep, machine, currentCount));

            if (currentCount > _retry && _retry > 0)
            {
                CDFMonitor.LogOutputHandler("CheckTimer: remoteAction retry limit reached. exiting.");
                return(false);
            }

            if (string.IsNullOrEmpty(machine))
            {
                // All machines have been processed so return false
                return(false);
            }

            if (!CDFMonitor.ManageGuiWorker(100 * currentCount / RemoteList.Keys.Count, string.Format(" {0}: {1}: {2}", machine, RemoteList[machine], description)))
            {
                return(false);
            }

            if (sleep && CDFMonitor.CloseCurrentSessionEvent.WaitOne(1000))
            {
                return(false);
            }

            return(true);
        }