private GUIListItem CreateListItem(UpcomingProgram upcomingProgram, UpcomingRecording recording, ScheduleSummary schedule) { GUIListItem item = new GUIListItem(); if (schedule != null) { //create list with schedules item.Label = schedule.Name; item.IsFolder = true; Utils.SetDefaultIcons(item); item.PinImage = Utility.GetLogoForSchedule(schedule.ScheduleType, schedule.IsOneTime, schedule.IsActive); item.TVTag = schedule; item.IsPlayed = !schedule.IsActive; } else { //create list with Upcoming Programs string title = upcomingProgram.CreateProgramTitle(); item.Label = title; string logoImagePath = Utility.GetLogoImage(upcomingProgram.Channel); if (!Utils.FileExistsInCache(logoImagePath)) { item.Label = String.Format("[{0}] {1}", upcomingProgram.Channel.DisplayName, title); logoImagePath = "defaultVideoBig.png"; } item.PinImage = Utility.GetIconImageFileName(_currentProgramType, upcomingProgram.IsPartOfSeries, upcomingProgram.CancellationReason, recording); item.TVTag = upcomingProgram; item.ThumbnailImage = logoImagePath; item.IconImageBig = logoImagePath; item.IconImage = logoImagePath; item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(upcomingProgram.StartTime), upcomingProgram.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), upcomingProgram.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); item.IsPlayed = upcomingProgram.IsCancelled; } return(item); }
private void Update(Schedule _schedule) { _upcomingEpsiodesList.Clear(); if (_programTimeLabel != null && _programTitleFadeLabel != null) { if (_upcomingProgram != null) { string strTime = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(_upcomingProgram.StartTime), _upcomingProgram.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), _upcomingProgram.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); _programTimeLabel.Label = strTime; _programTitleFadeLabel.Label = _upcomingProgram.Title; } else { _programTimeLabel.Label = string.Empty; _programTitleFadeLabel.Label = string.Empty; } } if (_schedule != null) { if (_schedule.ScheduleType == ScheduleType.Recording) { var recordings = Proxies.ControlService.GetUpcomingRecordings(_schedule.ScheduleId, true).Result; foreach (UpcomingRecording recording in recordings) { GUIListItem item = new GUIListItem(); string title = recording.Title; item.Label = title; string logoImagePath = Utility.GetLogoImage(recording.Program.Channel); if (logoImagePath == null || !System.IO.File.Exists(logoImagePath)) { item.Label = String.Format("[{0}] {1}", recording.Program.Channel.DisplayName, title); logoImagePath = "defaultVideoBig.png"; } item.PinImage = Utility.GetIconImageFileName(ScheduleType.Recording, recording.Program.IsPartOfSeries, recording.Program.CancellationReason, recording); item.TVTag = recording; item.ThumbnailImage = logoImagePath; item.IconImageBig = logoImagePath; item.IconImage = logoImagePath; item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(recording.StartTime), recording.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), recording.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); _upcomingEpsiodesList.Add(item); } } else { var _progs = Proxies.SchedulerService.GetUpcomingPrograms(_schedule, true).Result; foreach (UpcomingProgram program in _progs) { GUIListItem item = new GUIListItem(); string title = program.Title; item.Label = title; //item.OnItemSelected += new global::MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); string logoImagePath = Utility.GetLogoImage(program.Channel); if (logoImagePath == null || !System.IO.File.Exists(logoImagePath)) { item.Label = String.Format("[{0}] {1}", program.Channel.DisplayName, title); logoImagePath = "defaultVideoBig.png"; } if (_schedule.ScheduleType == ScheduleType.Alert) { item.PinImage = item.PinImage = Utility.GetIconImageFileName(ScheduleType.Alert, program.IsPartOfSeries, program.CancellationReason, null); } item.TVTag = program; item.ThumbnailImage = logoImagePath; item.IconImageBig = logoImagePath; item.IconImage = logoImagePath; item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(program.StartTime), program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); _upcomingEpsiodesList.Add(item); } } } _upcomingEpisodesLabel.IsVisible = (_upcomingEpsiodesList != null && _upcomingEpsiodesList.Count > 0); }
private void SetLabels() { UpcomingRecording[] upcomingRecordings = ControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true); UpcomingGuideProgram[] upcomingAlerts = SchedulerAgent.GetUpcomingGuidePrograms(ScheduleType.Alert, true); UpcomingGuideProgram[] upcomingSuggestions = SchedulerAgent.GetUpcomingGuidePrograms(ScheduleType.Suggestion, true); UpcomingGuideProgramsDictionary AllUpcomingGuidePrograms = new UpcomingGuideProgramsDictionary(upcomingRecordings, upcomingAlerts, upcomingSuggestions); foreach (GUIListItem item in _viewsList.ListItems) { if (item.Label != _parentDirectoryLabel) { UpcomingProgram program = item.TVTag as UpcomingProgram; if (program != null) { if (!item.IsFolder) { item.PinImage = null; Guid upcomingProgramId = program.UpcomingProgramId; if (AllUpcomingGuidePrograms.ContainsKey(upcomingProgramId)) { GuideUpcomingProgram programInfo = AllUpcomingGuidePrograms[upcomingProgramId]; item.PinImage = Utility.GetIconImageFileName(programInfo.Type, programInfo.IsPartOfSeries, programInfo.CancellationReason, programInfo.UpcomingRecording); } string title = GuideProgram.CreateProgramTitle(program.Title, program.SubTitle, program.EpisodeNumberDisplay); item.Label = title; string logoImagePath = Utility.GetLogoImage(program.Channel, _tvSchedulerAgent); if (logoImagePath == null || !System.IO.File.Exists(logoImagePath)) { item.Label = String.Format("[{0}] {1}", program.Channel.DisplayName, title); logoImagePath = "defaultVideoBig.png"; } item.ThumbnailImage = logoImagePath; item.IconImageBig = logoImagePath; item.IconImage = logoImagePath; item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(program.StartTime), program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); if (_currentSortMethod == SortMethod.Channel) { item.Label3 = program.Channel.DisplayName; } else { item.Label3 = program.Category; } } else { Utils.SetDefaultIcons(item); item.Label = program.Title; } } } } AllUpcomingGuidePrograms.Clear(); AllUpcomingGuidePrograms = null; }