コード例 #1
0
        /*
         * Spotify API calls
         */
        public async void SetActiveClient(SpotifyClient client)
        {
            VisualLogger.AddLine("Succesfully logged in, requesting user profile...");
            CurrentUser        = client;
            CurrentUserProfile = await client.UserProfile.Current();

            VisualLogger.AddLine("User profile received.");
        }
コード例 #2
0
        public MainWindowVM(ProgressBar searchProgressBar, TextBlock searchProgressText, ScrollViewer logScrollViewer)
        {
            m_LogScrollViewer       = logScrollViewer;
            VisualLogger            = new VisualLogger();
            VisualLogger.OnUpdated += (logText) => { LogText = logText; };
            VisualLogger.AddLine("Standing by.");

            SearchProgressBar = new ProgressBarWrapper(searchProgressBar, searchProgressText, () => {
                OnPropertyChanged(nameof(SearchProgressBar));
                if (SearchProgressBar.IsCompleted)
                {
                    VisualLogger.AddLine("Search completed.");
                }
            });

            UpdateSearchQuery(SearchQueryType.Artist);
        }
コード例 #3
0
        public async void CreatePlaylist()
        {
            VisualLogger.AddLine($"Creating playlist with {PlaylistSize} tracks...");
            PlaylistCreateRequest request = new PlaylistCreateRequest(Playlist.Name);

            request.Description = "Created via Akinify.";
            FullPlaylist playlist = await CurrentUser.Playlists.Create(CurrentUserProfile.Id, request);

            List <List <string> > trackUriBatches = Playlist.SelectTracks(PlaylistSize, CurrentSelectionType);

            foreach (List <string> trackUris in trackUriBatches)
            {
                await Task.Delay(100);

                await CurrentUser.Playlists.AddItems(playlist.Id, new PlaylistAddItemsRequest(trackUris));
            }
            VisualLogger.AddLine($"Playlist created: {Playlist.Name}");
        }