Beispiel #1
0
        public CityHostedService(
            LibraryService library,
            PublishingHouseService publishingHouse,
            SystemSpectator spectator)
        {
            _library         = library;
            _publishingHouse = publishingHouse;
            _spectator       = spectator;
            _timer           = new System.Timers.Timer(1000);

            _spectator.StateChanged  += SpectatorOnStateChanged;
            _spectator.HealthChecked += SpectatorOnHealthChecked;

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Gray;
        }
        public CityHostedService(
            LibraryService library,
            PublishingHouseService publishingHouse,
            SystemSpectator spectator)
        {
            _library         = library;
            _publishingHouse = publishingHouse;
            _spectator       = spectator;

            var interval = TimeSpan.FromSeconds(5);

            _timer          = new System.Timers.Timer(interval.TotalMilliseconds);
            _timer.Elapsed += TimerOnElapsed;

            _spectator.StateChanged  += SpectatorOnStateChanged;
            _spectator.HealthChecked += SpectatorOnHealthChecked;

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Gray;
        }