Esempio n. 1
0
        /// <summary>
        /// Downloads the video asynchronous.
        /// </summary>
        /// <returns></returns>
        private async Task DownloadVideoAsync()
        {
            //Build the video path to Hs
            var sys  = _selectedService.CurrentSystem;
            var rom  = _selectedService.CurrentRomname;
            var path = Path.Combine(_settings.HypermintSettings.HsPath, "Media", sys, "Video", rom + ".mp4");

            //Get a new incremented filename if already exists.
            var outputpath = VideoHelper.CreateIncrementalFileName(path);;

            token = source.Token;
            pdc   = await _dialog.ShowProgressAsync(this, "", "", true, new MetroDialogSettings()
            {
                CancellationToken = token,
            });

            pdc.SetCancelable(true);
            pdc.Canceled += Pdc_Canceled;

            await _youtube.YtDownload(SelectedVideo.VideoUrl, outputpath, Callback, token);

            await pdc.CloseAsync();
        }