Example #1
0
        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);
        }