public async Task<StorageFile> GetStorageFileAsync(DownloadInfo info)
 {
     try
     {
         if (await ToolClass.FileExists(Downloadfolder, info.FileName))
         {
             return await Downloadfolder.GetFileAsync(info.FileName);
         }
         else
             return null;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
 public async Task DeleteLocalFile(DownloadInfo info)
 {
     //删除本地文件
     await ToolClass.DeleteExistedFile(Downloadfolder,info.FileName);
 }
        /*
        // Enumerate the downloads that were going on in the background while the app was closed.
        public async Task DiscoverActiveDownloadsAsync()
        {
            IReadOnlyList<DownloadOperation> downloads = null;
            try
            {
                downloads = await BackgroundDownloader.GetCurrentDownloadsAsync();
            }
            catch (Exception ex)
            {
                if (!IsExceptionHandled("Discovery error", ex))
                {
                    throw;
                }
                return;
            }

            //Log("Loading background downloads: " + downloads.Count);

            if (downloads.Count > 0)
            {
                List<Task> tasks = new List<Task>();
                foreach (DownloadOperation download in downloads)
                {
                    //Log(String.Format(CultureInfo.CurrentCulture, "Discovered background download: {0}, Status: {1}", download.Guid, download.Progress.Status));

                    // Attach progress and completion handlers.
                    DownloadInfo d = downloadingInfoList.Where(down => down.DownOperation == download).FirstOrDefault();
                    if (d != null)
                        tasks.Add(HandleDownloadAsync(false, d));
                }

                // Don't await HandleDownloadAsync() in the foreach loop since we would attach to the second
                // download only when the first one completed; attach to the third download when the second one
                // completes etc. We want to attach to all downloads immediately.
                // If there are actions that need to be taken once downloads complete, await tasks here, outside
                // the loop.
                await Task.WhenAll(tasks);
            }
        }*/

        private async Task StartDownload(DownloadInfo downloadInfo)
        {
            downloadInfo.Status = DownloadStatus.Compare;
            Uri source;
            if (!Uri.TryCreate(downloadInfo.VideoUrl.Trim(), UriKind.Absolute, out source))
            {
                downloadInfo.Status = DownloadStatus.UrlError;
                return;
            }

            string destination = downloadInfo.FileName;
            if (string.IsNullOrWhiteSpace(destination))
            {
                downloadInfo.Status = DownloadStatus.NameNull;
                return;
            }

            StorageFile destinationFile;
            try
            {
                destinationFile = await Downloadfolder.CreateFileAsync(
                    destination, CreationCollisionOption.ReplaceExisting);
            }
            catch
            {
                //rootPage.NotifyUser("Error while creating file: " + ex.Message, NotifyType.ErrorMessage);
                downloadInfo.Status = DownloadStatus.CreatFileError;
                ToolClass.DeleteExistedFile(Downloadfolder, destination);
                return;
            }

            BackgroundDownloader downloader = new BackgroundDownloader();
            // downloader.CostPolicy = BackgroundTransferCostPolicy.Always;
            DownloadOperation download = downloader.CreateDownload(source, destinationFile);
            download.Priority = BackgroundTransferPriority.Default;

            downloadInfo.Cts = new CancellationTokenSource();

            DownloadParam downloadParameter = new DownloadParam
            {
                downloadInfo = downloadInfo,
                downloadOperation = download
            };

            // Attach progress and completion handlers.
            await HandleDownloadAsync(true, downloadParameter);
        }