Пример #1
0
        /// <summary>
        /// Start periodic evaluation using the currently set RunPeriod
        /// </summary>
        internal void StartPeriodicEvaluation()
        {
            if (pulseMaker == null)
            {
                pulseMaker = new PulseMaker();
            }

            pulseMaker.RunStarted += PulseMakerRunStarted;
            RefreshCompleted      += pulseMaker.OnRefreshCompleted;

            if (pulseMaker.TimerPeriod != 0)
            {
                throw new InvalidOperationException(
                          "Periodic evaluation cannot be started without stopping");
            }

            pulseMaker.Start(RunSettings.RunPeriod);
        }
Пример #2
0
        /// <summary>
        /// Start periodic evaluation by the given amount of time. If there
        /// is an on-going periodic evaluation, an exception will be thrown.
        /// </summary>
        /// <param name="milliseconds">The desired amount of time between two
        /// evaluations in milliseconds.</param>
        /// <param name="context">A synchronization context belonging to the
        /// thread on which you want PulseMaker callbacks to execute.</param>
        public void StartPeriodicEvaluation(int milliseconds)
        {
            if (pulseMaker == null)
            {
                pulseMaker = new PulseMaker();
            }

            pulseMaker.RunStarted += PulseMakerRunStarted;
            EvaluationCompleted   += pulseMaker.OnRunExpressionCompleted;

            if (pulseMaker.TimerPeriod != 0)
            {
                throw new InvalidOperationException(
                          "Periodic evaluation cannot be started without stopping");
            }

            pulseMaker.Start(milliseconds);
        }