public void OnStoped()
        {
            var message = "On Stopped in " + nameof(AgentLogConsumer) + "...";

            Log.Debug(message);
            AppLog(message);
            Timer.Enabled     = false;
            RestartAfterCount = 0;
            ThreadHelperClass.SetBackColor(_thisForm, IndicatorPanel, Color.Azure);
        }
        private void OnTimerTick()
        {
            if (Restarting)
            {
                return;
            }
            if (RestartAfterCount >= MaxRestartCount)
            {
                Restarting = true;
                OnStoped();
                const string message = "Max restart counter exceeded, application will now be restarted!!!";
                Log.Debug(message);
                ThreadHelperClass.SetBackColor(_thisForm, IndicatorPanel, Color.Red);
                try
                {
                    if (!DebugMode)
                    {
                        ExecuteWindowsShortCut(ShorCutToExecute);
                    }
                    _justRecovered = true;
                    Log.Debug("Restart executed successfully");
                    AppLog("Restart executed successfully");
                }
                catch (Exception e)
                {
                    Log.Error(e, "Error trying to execute restart command");
                    AppLog("Error trying to execute restart command " + e.Message + " - " + e.InnerException?.Message);
                }

                System.Threading.Thread.Sleep(5000);
                OnStarted();
            }
            else
            {
                if (_justRecovered)
                {
                    Log.Debug("System just restarted. Everything looks good!");
                    AppLog("System just restarted. Everything looks good!");
                    _justRecovered = false;
                }

                ThreadHelperClass.SetBackColor(_thisForm, IndicatorPanel, Color.GreenYellow);
            }
            Restarting        = false;
            RestartAfterCount = 0;
        }