Ejemplo n.º 1
0
        public override void Open <T>(T item)
        {
            var searchTerm = item as SearchQuery;

            if (searchTerm.EntityType == typeof(Artist))
            {
                _artistModel.GetItems(searchTerm);
                _artistGrid.Visible   = true;
                _albumGrid.Visible    = false;
                _songGrid.Visible     = false;
                _playlistGrid.Visible = false;
                return;
            }
            if (searchTerm.EntityType == typeof(Album))
            {
                _albumModel.GetItems(searchTerm);
                _artistGrid.Visible   = false;
                _albumGrid.Visible    = true;
                _songGrid.Visible     = false;
                _playlistGrid.Visible = false;
                return;
            }
            if (searchTerm.EntityType == typeof(Song))
            {
                _songModel.GetItems(searchTerm);
                _artistGrid.Visible   = false;
                _albumGrid.Visible    = false;
                _songGrid.Visible     = true;
                _playlistGrid.Visible = false;
                return;
            }
            if (searchTerm.EntityType == typeof(Playlist))
            {
                _playlistModel.GetItems(searchTerm);
                _artistGrid.Visible   = false;
                _albumGrid.Visible    = false;
                _songGrid.Visible     = false;
                _playlistGrid.Visible = true;
            }
        }
        private void SearchButtonClick(object sender, EventArgs e)
        {
            var searchQuery = new SearchQuery(_searchText.Text, typeof(Song));

            _model.GetItems(searchQuery);
        }