请问我做的后台下载为啥直到下载完成前没法获取文件总大小呢
BackgroundDownloader downloader = new BackgroundDownloader();
StorageFile file = await KnownFolders.MusicLibrary.CreateFileAsync("1.mp3",CreationCollisionOption.ReplaceExisting);
download = downloader.CreateDownload(new Uri("http://caige.uwp.store/AppAssets/Music/1.mp3"), file);
await download.StartAsync();
GameData.ShowBaiFenBi = ThreadPoolTimer.CreatePeriodicTimer(async(T) =>
{
if (download.Progress.TotalBytesToReceive > 0)
{
double d = download.Progress.BytesReceived / download.Progress.TotalBytesToReceive * 100;
double baiFenBi = Double.Parse(d.ToString("F1"));
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Downloading_ProgressBar.Value = baiFenBi;
});
}
}, TimeSpan.FromMilliseconds(500));
请问为啥直到下载完成前没法获取文件总大小
因为没法获取总大小的关系,下载完成前没法提供进度