} // buttonOk_Click_Implementation #endregion #region 'General' form setup & get data private void InitGeneralData() { // service logo var serviceLogo = AppUiConfiguration.Current.ServiceLogoMappings.FromServiceKey(Task.Channel.ServiceKey); pictureChannelLogo.Image = serviceLogo.GetImage(LogoSize.Size64); // service name labelChannelName.Text = string.Format("{0} {1}", Task.Channel.LogicalNumber, Task.Channel.Name); // program name if (Task.Program != null) { labelProgramDescription.Text = Task.Program.Title; labelProgramSchedule.Text = string.Format("{0} ({1})", FormatString.DateTimeFromToMinutes(Task.Program.LocalStartTime, Task.Program.LocalEndTime, LocalReferenceTime), FormatString.TimeSpanTotalMinutes(Task.Program.Duration, FormatString.Format.Extended)); } else { labelChannelName.Top = pictureChannelLogo.Top; labelChannelName.Height = pictureChannelLogo.Height; labelProgramDescription.Visible = false; labelProgramSchedule.Visible = false; } // if-else } // InitGeneralData
} // constructor public void DisplayData(UiBroadcastService service, EpgProgram epgProgram, DateTime referenceTime, string caption) { Service = service; EpgProgram = epgProgram; labelProgramCaption.Text = caption; labelProgramCaption.Visible = caption != null; labelProgramTime.Visible = (epgProgram != null); labelProgramDetails.Visible = (epgProgram != null); pictureProgramThumbnail.ImageLocation = null; buttonProgramProperties.Visible = (epgProgram != null); pictureProgramThumbnail.Cursor = (epgProgram != null) ? Cursors.Hand : Cursors.Default; if (EpgProgram == null) { labelProgramTitle.Text = Properties.Texts.EpgNoInformation; pictureProgramThumbnail.Image = Properties.Resources.EpgNoProgramImage; } else { labelProgramTitle.Text = EpgProgram.Title; labelProgramTime.Text = string.Format("{0} ({1})", FormatString.DateTimeFromToMinutes(EpgProgram.LocalStartTime, EpgProgram.LocalEndTime, referenceTime), FormatString.TimeSpanTotalMinutes(EpgProgram.Duration, FormatString.Format.Extended)); labelProgramDetails.Text = string.Format("{0} / {1}", (EpgProgram.Genre != null) ? EpgProgram.Genre.Description : Properties.Texts.EpgNoGenre, (EpgProgram.ParentalRating != null) ? EpgProgram.ParentalRating.Description : Properties.Texts.EpgNoParentalRating); pictureProgramThumbnail.Image = Properties.Resources.EpgLoadingProgramImage; pictureProgramThumbnail.ImageLocation = null; // TODO: EPG // pictureProgramThumbnail.ImageLocation = IpTvProvider.Current.EpgInfo.GetEpgProgramThumbnailUrl(service, EpgProgram, false); } // if-else } // DisplayData
} // DisplayEpgPrograms private void DisplayEpgProgram(int index) { TimeSpan ellapsed; if ((index < 0) || (index > 3)) { return; } EpgIndex = index; epgProgressBar.Visible = (index == 1); labelEndTime.Visible = (index == 1); labelStartTime.Visible = (index == 1); labelFromTo.Visible = (index != 1); var epgProgram = EpgPrograms?[EpgIndex]; buttonDetails.Enabled = DetailsEnabled && (epgProgram != null) && (!epgProgram.IsBlank); labelProgramTitle.Text = (epgProgram != null) ? epgProgram.Title : Properties.Texts.EpgNoInformation; if (epgProgram == null) { labelFromTo.Text = null; labelStartTime.Text = null; labelEllapsed.Text = null; EnableBackForward(false, false); return; } // if switch (EpgIndex) { case 0: labelFromTo.Text = FormatString.DateTimeFromToMinutes(epgProgram.LocalStartTime, epgProgram.LocalEndTime, LocalReferenceTime); ellapsed = (LocalReferenceTime - epgProgram.LocalEndTime); labelEllapsed.Text = string.Format(Properties.Texts.ProgramEnded, FormatString.TimeSpanTotalMinutes(ellapsed, FormatString.Format.Extended)); EnableBackForward(false, EpgPrograms[1] != null); break; case 1: labelStartTime.Text = string.Format("{0:HH:mm}", epgProgram.LocalStartTime); labelEndTime.Text = string.Format("{0:t}", epgProgram.LocalEndTime); ellapsed = (LocalReferenceTime - epgProgram.LocalStartTime); epgProgressBar.MaximumValue = epgProgram.Duration.TotalMinutes; epgProgressBar.Value = ellapsed.TotalMinutes; labelEllapsed.Text = string.Format(Properties.Texts.ProgramStarted, FormatString.TimeSpanTotalMinutes(ellapsed, FormatString.Format.Extended)); EnableBackForward(EpgPrograms[0] != null, EpgPrograms[2] != null); break; default: labelFromTo.Text = FormatString.DateTimeFromToMinutes(epgProgram.LocalStartTime, epgProgram.LocalEndTime, LocalReferenceTime); ellapsed = (epgProgram.LocalStartTime - LocalReferenceTime); labelEllapsed.Text = string.Format(Properties.Texts.ProgramWillStart, FormatString.TimeSpanTotalMinutes(ellapsed, FormatString.Format.Extended)); EnableBackForward(SafeGetItem(EpgPrograms, EpgIndex - 1) != null, SafeGetItem(EpgPrograms, EpgIndex + 1) != null); break; } // switch } // DisplayEpgProgram
} // ChangeOkButtonText private void SetChannelDetails() { pictureChannelLogo.Image = SelectedService.Logo.GetImage(Configuration.Logos.LogoSize.Size64); labelChannelName.Text = string.Format("{0} {1}", SelectedService.DisplayLogicalNumber, SelectedService.DisplayName); if (SelectedProgram != null) { labelProgramDescription.Text = SelectedProgram.Title; labelProgramSchedule.Text = string.Format("{0} ({1})", FormatString.DateTimeFromToMinutes(SelectedProgram.LocalStartTime, SelectedProgram.LocalEndTime, LocalReferenceTime), FormatString.TimeSpanTotalMinutes(SelectedProgram.Duration, FormatString.Format.Extended)); } else { labelChannelName.Top = pictureChannelLogo.Top; labelChannelName.Height = pictureChannelLogo.Height; labelProgramDescription.Visible = false; labelProgramSchedule.Visible = false; } // if-else } // SetChannelDetails