Example #1
0
        private void SetProperties(UpcomingProgram program)
        {
            string guiPropertyPrefix = _channelType == ChannelType.Television ? "#TV" : "#Radio";

            if (program == null)
            {
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Channel");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Title");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Genre");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Time");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Description");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.thumb");
            }
            else
            {
                string strTime = string.Format("{0} {1} - {2}",
                                               Utility.GetShortDayDateString(program.StartTime),
                                               program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                               program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Channel", program.Channel.DisplayName);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Title", program.Title);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Genre", program.Category);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Time", strTime);
                string logo = Utility.GetLogoImage(program.Channel.ChannelId, program.Channel.DisplayName, _tvSchedulerAgent);
                if (System.IO.File.Exists(logo))
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.thumb", logo);
                }
                else
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.thumb", "defaultVideoBig.png");
                }

                GuideProgram guideProgram = GuideAgent.GetProgramById(program.GuideProgramId.Value);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Description", guideProgram.CreateCombinedDescription(true));
            }
        }