Пример #1
0
        public async void Search(object parameter)
        {
            SongLabelVisibility   = "Collapsed";
            ArtistLabelVisibility = "Collapsed";
            AlbumLabelVisibility  = "Collapsed";
            if (SearchQuery == "" || SearchQuery == null)
            {
                return;
            }
            HttpRequestMessage message = new HttpRequestMessage
            {
                Method     = HttpMethod.Get,
                RequestUri = new Uri("https://mclients.googleapis.com/sj/v1.11/query?q=" + SearchQuery + "&max-results=50", UriKind.Absolute)
            };
            HttpResponseMessage returnString = await HttpCall.MakeGetCallAsync(message);

            var songString = await returnString.Content.ReadAsStringAsync();

            AllHits = JsonParser.Parse(songString);
            if (AllHits.entries != null)
            {
                SongHits   = Hits.GetSongHits(AllHits.entries, 5);
                ArtistHits = Hits.GetArtistHits(AllHits.entries, 5);
                AlbumHits  = Hits.GetAlbumHits(AllHits.entries, 5);
            }
            if (SongHits != null && SongHits.Count != 0)
            {
                SongLabelVisibility = "Visible";
            }
            if (ArtistHits != null && ArtistHits.Count != 0)
            {
                ArtistLabelVisibility = "Visible";
            }
            if (AlbumHits != null && AlbumHits.Count != 0)
            {
                AlbumLabelVisibility = "Visible";
            }
            OnPropertyChanged("SongHits");
            OnPropertyChanged("ArtistHits");
            OnPropertyChanged("AlbumHits");
            OnPropertyChanged("SongLabelVisibility");
            OnPropertyChanged("ArtistLabelVisibility");
            OnPropertyChanged("AlbumLabelVisibility");
        }
Пример #2
0
 public void NavigateToAllSongs(object parameter)
 {
     NavigationService.GetInstance().Navigate(typeof(AllSongsPage), Hits.GetSongHits(AllHits.entries, 50));
 }