Пример #1
0
        /// <summary>
        /// Private use only.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            if (GlobalInitializationOps.SecondaryInitFailed)
            {
                ExitCode = 0x425;                 // Win32 error code; see http://msdn.microsoft.com/en-us/library/cc231199.aspx.
                Stop();
                return;
            }

            Action method = () => {
                lastTickInstant = SystemClock.Instance.GetCurrentInstant();
                service.Init();

                timer = new Timer(tick, null, tickInterval, Timeout.Infinite);
            };

            if (!TelemetryStatics.ExecuteBlockWithStandardExceptionHandling(method))
            {
                ExitCode = 0x428;                 // Win32 error code; see http://msdn.microsoft.com/en-us/library/cc231199.aspx.
                Stop();
            }
        }
        /// <summary>
        /// Private use only.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            if (AppTools.SecondaryInitFailed)
            {
                ExitCode = 0x425;                 // Win32 error code; see http://msdn.microsoft.com/en-us/library/cc231199.aspx.
                Stop();
                return;
            }

            Action method = () => {
                lastHealthCheckDateAndTime = DateTime.Now;
                service.Init();

                timer = new Timer(tick, null, tickInterval, Timeout.Infinite);
            };

            if (!AppTools.ExecuteBlockWithStandardExceptionHandling(method))
            {
                ExitCode = 0x428;                 // Win32 error code; see http://msdn.microsoft.com/en-us/library/cc231199.aspx.
                Stop();
            }
        }