예제 #1
0
 public AllSongsViewModel()
 {
     GoBackCommand     = new RelayCommand(GoBack);
     AddToQueueCommand = new RelayCommand(AddToQueue);
     PlayCommand       = new RelayCommand(Play);
     SongHits          = (List <Song>)NavigationService.GetInstance().Content;
 }
예제 #2
0
 public ArtistViewModel()
 {
     CurrentArtist = (Artist)NavigationService.GetInstance().Content;
     ArtistName    = CurrentArtist.ArtistName;
     ArtistArtRef  = CurrentArtist.ArtistArtRef;
     ArtistSongs   = CurrentArtist.TopTracks;
     ArtistTopFive = new List <Song>();
     if (ArtistSongs != null)
     {
         for (int i = 0; i < 5 && i < ArtistSongs.Count; i++)
         {
             ArtistTopFive.Add(ArtistSongs[i]);
         }
     }
     GoBackCommand            = new RelayCommand(GoBack);
     PlayOverrideQueueCommand = new RelayCommand(PlayOverrideQueue);
     AddToQueueCommand        = new RelayCommand(AddToQueue);
     ArtistAlbums             = CurrentArtist.ArtistAlbums;
     TopFiveAlbums            = new List <Album>();
     if (ArtistAlbums != null)
     {
         for (int i = 0; i < 5 && i < ArtistAlbums.Count; i++)
         {
             TopFiveAlbums.Add(ArtistAlbums[i]);
         }
     }
 }
예제 #3
0
 public AlbumViewModel()
 {
     CurrentAlbum             = (Album)NavigationService.GetInstance().Content;
     SongList                 = CurrentAlbum.AlbumTracks;
     AlbumTitle               = CurrentAlbum.AlbumName;
     AlbumArtist              = CurrentAlbum.AlbumArtist;
     AlbumArtRef              = CurrentAlbum.AlbumArtRef;
     GoBackCommand            = new RelayCommand(GoBack);
     PlayOverrideQueueCommand = new RelayCommand(PlayOverrideQueue);
     AddToQueueCommand        = new RelayCommand(AddToQueue);
 }
예제 #4
0
        public async void NavigateToAlbum(object parameter)
        {
            Album currentAlbum         = (Album)parameter;
            HttpRequestMessage message = new HttpRequestMessage
            {
                Method     = HttpMethod.Get,
                RequestUri = new Uri("https://mclients.googleapis.com/sj/v1.11/fetchalbum?alt=json&nid=" + currentAlbum.Id + "&include-tracks=true", UriKind.Absolute)
            };
            HttpResponseMessage returnString = await HttpCall.MakeGetCallAsync(message);

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

            currentAlbum = JsonParser.ParseAlbum(str);
            NavigationService.GetInstance().Navigate(typeof(AlbumPage), currentAlbum);
        }
예제 #5
0
        public async void PerformLogin(object parameter)
        {
            Auth auth            = Auth.getInstance();
            bool loginSuccessful = await auth.Login(Username, Password);

            if (loginSuccessful)
            {
                NavigationService.GetInstance().Navigate(typeof(MainMenu), auth.authToken);
            }
            else
            {
                ShowErrorMessage = "Visible";
                OnPropertyChanged("ShowErrorMessage");
            }
        }
예제 #6
0
        public async void NavigateToArtist(object parameter)
        {
            Artist             currentArtist = (Artist)parameter;
            HttpRequestMessage message       = new HttpRequestMessage
            {
                Method     = HttpMethod.Get,
                RequestUri = new Uri("https://mclients.googleapis.com/sj/v1.11/fetchartist?alt=json&nid="
                                     + currentArtist.ArtistId + "&include-albums=true&num-top-tracks=50&num-related-artists=5", UriKind.Absolute)
            };
            HttpResponseMessage returnString = await HttpCall.MakeGetCallAsync(message);

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

            currentArtist = JsonParser.ParseArtist(str);
            NavigationService.GetInstance().Navigate(typeof(ArtistPage), currentArtist);
        }
예제 #7
0
 public void NavigateToAllArtists(object parameter)
 {
     NavigationService.GetInstance().Navigate(typeof(AllArtistsPage), Hits.GetArtistHits(AllHits.entries, 50));
 }
 public void GoBack(object parameter)
 {
     NavigationService.GetInstance().GoBack();
 }
 public AllArtistsViewModel()
 {
     ArtistHits              = (List <Artist>)NavigationService.GetInstance().Content;
     GoBackCommand           = new RelayCommand(GoBack);
     NavigateToArtistCommand = new RelayCommand(NavigateToArtist);
 }