Exemplo n.º 1
0
        public async Task<LiveTvInfo> GetLiveTvInfo(CancellationToken cancellationToken)
        {
            var services = await GetServiceInfos(CancellationToken.None).ConfigureAwait(false);
            var servicesList = services.ToList();

            var activeServiceInfo = ActiveService == null ? null :
                servicesList.FirstOrDefault(i => string.Equals(i.Name, ActiveService.Name, StringComparison.OrdinalIgnoreCase));

            var info = new LiveTvInfo
            {
                Services = servicesList.ToList(),
                ActiveServiceName = activeServiceInfo == null ? null : activeServiceInfo.Name,
                IsEnabled = ActiveService != null,
                Status = activeServiceInfo == null ? LiveTvServiceStatus.Unavailable : activeServiceInfo.Status,
                StatusMessage = activeServiceInfo == null ? null : activeServiceInfo.StatusMessage
            };

            info.EnabledUsers = _userManager.Users
                .Where(IsLiveTvEnabled)
                .Select(i => i.Id.ToString("N"))
                .ToList();

            return info;
        }
Exemplo n.º 2
0
        public async Task<LiveTvInfo> GetLiveTvInfo(CancellationToken cancellationToken)
        {
            var services = await GetServiceInfos(CancellationToken.None).ConfigureAwait(false);
            var servicesList = services.ToList();

            var info = new LiveTvInfo
            {
                Services = servicesList.ToList(),
                IsEnabled = servicesList.Count > 0
            };

            info.EnabledUsers = _userManager.Users
                .Where(IsLiveTvEnabled)
                .Select(i => i.Id.ToString("N"))
                .ToList();

            return info;
        }