示例#1
0
        public async Task StartTracking()
        {
            await _siteStorage.ResetAllStatuses();

            var sites = await _siteStorage.GetSitesInfo();

            var tasks = sites.Select(x => _trackingTimer.Start(x.Id, x.Uri, x.RefreshTimeInSeconds));
            await Task.WhenAll(tasks);
        }
示例#2
0
        public async Task UpdateSitesInfo()
        {
            var data = await _siteStorage.GetSitesInfo();

            var processedData = data.Select(x =>
                                            new SiteInfoClientData(
                                                x.Id,
                                                x.Uri.ToString(),
                                                x.RefreshTimeInSeconds.Seconds,
                                                (int)x.Status))
                                .ToArray();

            await _hubContext.Clients.All.ReceiveMonitoringData(processedData);
        }
        public override async Task OnConnectedAsync()
        {
            await base.OnConnectedAsync();

            var data = await _siteStorage.GetSitesInfo();

            var processedData = data.Select(x =>
                                            new SiteInfoClientData(
                                                x.Id,
                                                x.Uri.ToString(),
                                                x.RefreshTimeInSeconds.Seconds,
                                                (int)x.Status))
                                .ToArray();

            await Clients.Caller.ReceiveMonitoringData(processedData);
        }