예제 #1
0
        private void TimerTick(object state)
        {
            try
            {
                UpdateCaches();
                var overview = CreateOverview();
                OnInfoUpdated?.Invoke(overview);

                _lastTickTime = DateTime.Now;
            }
            catch (Exception e)
            {
                _logger.Error("Unexpected exception in main timer", e);
            }
        }
예제 #2
0
        public async Task StartAsync()
        {
            if (started)
            {
                return;
            }

            hub = new HubConnectionBuilder()
                  .WithUrl(hubUrl)
                  .Build();

            hub.On <PlayerInfo>(Messages.UpdatePlayerInfo, info => {
                OnInfoUpdated?.Invoke(info);
            });

            await hub.StartAsync();

            started = true;

            await Register();
        }