Пример #1
0
        public async void DownloadButtonClick()
        {
            List <Playlist> playlistsToBeDownloaded = new List <Playlist>();

            foreach (PlaylistViewModel playVM in playlistsSelected)
            {
                if (playVM.PlaylistModel.clips.Count == 0)
                {
                    ClipResponse response = await ServiceAccessor.GetPlaylistClipsAndHeaders(playVM.PlaylistModel.playlistId);

                    playVM.PlaylistModel.clips          = response.clips;
                    playVM.PlaylistModel.displayColumns = response.DisplayColumns;
                }
                List <Clip> additionalClips = await ServiceAccessor.GetAdditionalPlaylistClips(playVM.PlaylistModel.playlistId, playVM.PlaylistModel.clips.Count);

                foreach (Clip c in additionalClips)
                {
                    playVM.PlaylistModel.clips.Add(c);
                }
                playlistsToBeDownloaded.Add(playVM.PlaylistModel);
            }
            DownloadButton_Visibility     = Visibility.Collapsed;
            Downloading_Visibility        = Visibility.Visible;
            DownloadProgressText          = "Preparing Download";
            DownloadProgress              = 0;
            DownloadAccessor.Instance.cts = new CancellationTokenSource();
            DownloadAccessor.Instance.currentlyDownloadingPlaylists = playlistsToBeDownloaded;
            DownloadAccessor.Instance.progressCallback = new Progress <DownloadOperation>(ProgressCallback);
            DownloadAccessor.Instance.DownloadPlaylists(playlistsToBeDownloaded, Season.DeepCopy(Parameter.season));
        }