private void SetProgramDetails(TvChannel currentChannel) { var program = HttpTvProgramClient.GetProgramAsync(currentChannel.ApiChannelId, 1).GetAwaiter().GetResult(); var programEntry = program.Data?.First().Entries?.First(); if (programEntry == null) { return; } var durationTime = programEntry.End - programEntry.Start; var viewedTime = DateTimeOffset.Now - programEntry.Start; var viewedPercentage = viewedTime.TotalMilliseconds / durationTime.TotalMilliseconds; SetUI(() => { ProgramTitle.Content = programEntry.Title; if (programEntry.Photo != null) { TvContentImage.Source = new BitmapImage(programEntry.Photo); } Duration.Content = durationTime.ToString(); ProgramProgress.Value = viewedPercentage; WindowContent.Title = currentChannel.Name; ProgramDescription.Text = programEntry.Description; }); }
private void SetChannelDetails(TvChannel currentChannel) { SetUI(() => { ChannelLogo.Source = new BitmapImage(new Uri(currentChannel.LogoUrl)); }); }