Example #1
0
        public static void VizualizeNewSearchResultByName <T>(Panel allItemsPanel, TextBox searchBox, IList <T> items)
            where T : IDescription
        {
            string   searchedText = searchBox.Text.ToLower();
            List <T> result       = new List <T>();

            if (!string.IsNullOrEmpty(searchedText) && !searchedText.Equals("search by name"))
            {
                result = items.ToList().FindAll(item => item.Name.ToLower().Contains(searchedText));
            }
            else
            {
                result = new List <T>(items);
            }

            ElementRenderer.VisualizeAllElementsToPanel(allItemsPanel, result);
        }
Example #2
0
        public static void VizualizeItemsBySelectedGenres <T>(
            Panel panelToVisualize, Panel selectedGenresPanel, IList <T> items, string search)
            where T : IDescription
        {
            IList <string> selectedGenres = ElementRenderer.GetSelectedGenres(selectedGenresPanel);

            if (selectedGenres.Count > 0)
            {
                IList <T> result = new List <T>();

                foreach (var item in items)
                {
                    if (item.Genres.Count >= selectedGenres.Count)
                    {
                        bool valid = true;

                        foreach (var genre in selectedGenres)
                        {
                            if (!item.Genres.Contains(genre))
                            {
                                valid = false;
                                break;
                            }
                        }

                        if (valid && item.Name.ToLower().Contains(search.ToLower()))
                        {
                            result.Add(item);
                        }
                    }
                }

                ElementRenderer.VisualizeAllElementsToPanel(panelToVisualize, result);
            }
            else
            {
                ElementRenderer.VisualizeAllElementsToPanel(panelToVisualize, items);
            }
        }
 public MusicLibrary()
 {
     this.InitializeComponent();
     ElementRenderer.VisualizeAllElementsToPanel <Music>(this.AllMusicPanel, App.Resources.Music);
 }
 public MoviesLibrary()
 {
     this.InitializeComponent();
     ElementRenderer.VisualizeAllElementsToPanel <Movie>(this.AllMoviesPanel, App.Resources.Movies);
 }