예제 #1
0
        private void Search()
        {
            Log.Info("newsearch Search:{0} {1}", _searchKeyword, SearchFor);
            GUIControl.ClearControl(GetID, listResults.GetID);
            TvBusinessLayer layer        = new TvBusinessLayer();
            IList <Program> listPrograms = null;

            switch (SearchFor)
            {
            case SearchType.Genres:
                listPrograms = layer.SearchProgramsPerGenre("%" + _searchKeyword + "%", "");
                break;

            case SearchType.KeyWord:
                listPrograms = layer.SearchProgramsByDescription("%" + _searchKeyword);
                break;

            case SearchType.Title:
                listPrograms = layer.SearchPrograms("%" + _searchKeyword);
                break;
            }
            if (listPrograms == null)
            {
                return;
            }
            if (listPrograms.Count == 0)
            {
                return;
            }
            Log.Info("newsearch found:{0} progs", listPrograms.Count);
            foreach (Program program in listPrograms)
            {
                GUIListItem item = new GUIListItem();
                item.Label = TVUtil.GetDisplayTitle(program);
                string logo = Utils.GetCoverArt(Thumbs.TVChannel, program.ReferencedChannel().DisplayName);
                if (string.IsNullOrEmpty(logo))
                {
                    logo = "defaultVideoBig.png";
                }
                item.ThumbnailImage = logo;
                item.IconImageBig   = logo;
                item.IconImage      = logo;
                item.TVTag          = program;
                listResults.Add(item);
            }
        }