private void TimerTick(object sender, ElapsedEventArgs e)
        {
            Logger.Log(nameof(TimerControlledScriptStarter),
                       nameof(TimerTick), "0");

            if (!ScriptStarted || Script.HasFinishedUnsuccessfully)
            {
                if (ScriptStarted && Script.HasFinishedUnsuccessfully && !AutoRestart)
                {
                    timer.Stop();
                    HasFinishedUnsuccessfully = true;
                    return;
                }

                StartScriptInThisTick = true;

                Logger.Log(nameof(TimerControlledScriptStarter),
                           nameof(TimerTick), ScriptStarted.ToString());
            }
            else if (Script.HasFinishedSuccessfully)
            {
                timer.Stop();
            }

            timer.Interval = GetRandomInterval();
        }
Пример #2
0
        private void TimerTick(object sender, ElapsedEventArgs e)
        {
            if (!ScriptStarted || Script.HasFinishedUnsuccessfully)
            {
                if (ScriptStarted && Script.HasFinishedUnsuccessfully && !AutoRestart)
                {
                    timer.Stop();
                    HasFinishedUnsuccessfully = true;
                    return;
                }

                StartScriptInThisTick = true;

                Logger.Log(nameof(SequentialScriptStarter),
                           nameof(TimerTick), ScriptStarted.ToString());
            }
            else if (Script.HasFinishedSuccessfully)
            {
                timer.Stop();
            }
        }