private async void logInButton_Click(object sender, RoutedEventArgs e) { GetAuth(); if (sett.VKToken != "") { //albums albums = new Albums(); await Task.Factory.StartNew(() => albums.DownloadAlbums(new string[] { sett.UserId, sett.VKToken })); FillAlbums(albums); //my tracks playlist = new PlayListVk(); playlistAll = playlist; await Task.Factory.StartNew(() => playlist.DownloadTracks(new string[] { sett.UserId, sett.VKToken })); tracksCountLabel.Content = playlist.Count() + " треків"; FillListBox((PlayListVk)playlist, listBox, false, true, true); //users loadFriendList(); //search search = new Search(sett.VKToken); //recommeds recommendations = new Reccomendations(sett.VKToken); UpdateRecommendations(); } }
private async void updateButton_Click(object sender, RoutedEventArgs e) { bool isPlaying = playlistAll == playlist; var currTrack = ((PlayListVk)playlistAll).GetCurrentTrackVK(); string selTrack = ""; if (currTrack != null) selTrack = currTrack.aid; listBox.Items.Clear(); tracksCountLabel.Content = "0 треків"; playlistAll = new PlayListVk(); await Task.Factory.StartNew(() => playlistAll.DownloadTracks(new string[] { sett.UserId, sett.VKToken })); tracksCountLabel.Content = playlistAll.Count() + " треків"; FillListBox((PlayListVk)playlistAll, listBox, false, true, true); if (isPlaying) playlist = playlistAll; if (currTrack != null) { ((PlayListVk)playlistAll).SelectTrackByAid(selTrack); listBox.SelectedIndex = ((PlayListVk)playlistAll).SelTrack; } }