/// <summary> /// Initializes a new instance of the GuideViewModel class. /// </summary> public GuideViewModel(INavigationService navigationService, IConnectionManager connectionManager) : base(navigationService, connectionManager) { if (IsInDesignMode) { SelectedChannel = new ChannelInfoDto { Name = "BBC One", Number = "1" }; Programmes = new ObservableCollection<BaseItemDto> { new BaseItemDto { StartDate = new DateTime(2014, 1, 16, 6, 0, 0), Name = "Breakfast News", EpisodeTitle = "16/01/2013", Overview = "The latest news, sport, business and weather from the BBC's Breakfast Team" }, new BaseItemDto { StartDate = new DateTime(2014, 1, 16, 9, 15, 0), Name = "Wanted Down Under", EpisodeTitle = "Series 8, Davidson Family", Overview = "A mum and son want to move toAustralia, but can they presaude the rest of the family?" } }; } }
/// <summary> /// Gets the channel info dto. /// </summary> /// <param name="info">The info.</param> /// <param name="currentProgram">The current program.</param> /// <param name="user">The user.</param> /// <returns>ChannelInfoDto.</returns> public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, LiveTvProgram currentProgram, User user = null) { var dto = new ChannelInfoDto { Name = info.Name, ServiceName = info.ServiceName, ChannelType = info.ChannelType, Number = info.Number, Type = info.GetClientTypeName(), Id = info.Id.ToString("N"), MediaType = info.MediaType, ExternalId = info.ExternalId, MediaSources = info.GetMediaSources(true).ToList() }; if (user != null) { dto.UserData = _userDataManager.GetUserDataDto(info, user); dto.PlayAccess = info.GetPlayAccess(user); } var imageTag = GetImageTag(info); if (imageTag != null) { dto.ImageTags[ImageType.Primary] = imageTag; _dtoService.AttachPrimaryImageAspectRatio(dto, info); } if (currentProgram != null) { dto.CurrentProgram = GetProgramInfoDto(currentProgram, info, user); } return dto; }
/// <summary> /// Gets the channel info dto. /// </summary> /// <param name="info">The info.</param> /// <param name="currentProgram">The current program.</param> /// <param name="user">The user.</param> /// <returns>ChannelInfoDto.</returns> public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, LiveTvProgram currentProgram, User user = null) { var dto = new ChannelInfoDto { Name = info.Name, ServiceName = info.ServiceName, ChannelType = info.ChannelType, Number = info.Number, Type = info.GetClientTypeName(), Id = info.Id.ToString("N"), MediaType = info.MediaType, ExternalId = info.ExternalId, MediaSources = _dtoService.GetMediaSources(info) }; if (user != null) { dto.UserData = _dtoService.GetUserItemDataDto(_userDataManager.GetUserData(user.Id, info.GetUserDataKey())); dto.PlayAccess = info.GetPlayAccess(user); } var imageTag = GetImageTag(info); if (imageTag.HasValue) { dto.ImageTags[ImageType.Primary] = imageTag.Value; } if (currentProgram != null) { dto.CurrentProgram = GetProgramInfoDto(currentProgram, info, user); } return dto; }
/// <summary> /// Gets the channel info dto. /// </summary> /// <param name="info">The info.</param> /// <param name="user">The user.</param> /// <returns>ChannelInfoDto.</returns> public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, User user = null) { var channelInfo = info.ChannelInfo; var dto = new ChannelInfoDto { Name = info.Name, ServiceName = info.ServiceName, ChannelType = channelInfo.ChannelType, Number = channelInfo.Number, Type = info.GetClientTypeName(), Id = info.Id.ToString("N"), MediaType = info.MediaType, ExternalId = channelInfo.Id }; if (user != null) { dto.UserData = _dtoService.GetUserItemDataDto(_userDataManager.GetUserData(user.Id, info.GetUserDataKey())); } var imageTag = GetImageTag(info); if (imageTag.HasValue) { dto.ImageTags[ImageType.Primary] = imageTag.Value; } return dto; }