Пример #1
0
        /// <summary>
        /// Executes the <see cref="RunIteration"/> method periodically until stopped.
        /// The minimum time between the executions is <see cref="IterationTime"/>.
        /// </summary>
        private void Execute()
        {
            var waiter = new IterationWaiter(_iterationTime);

            while (_isRunning)
            {
                waiter.Start();

                try
                {
                    RunIteration();
                }
                catch (Exception ex)
                {
                    OnRunIterationException(ex);
                }

                waiter.Wait();
            }
        }