我正在使用WP 8.1 WinRT projrect,其中我正在下载文件,当我得到ResponseInformation statusCode为200时,我尝试打开该文件,我收到以下错误:
System.Runtime.InteropServices.COMException(0x80004005):错误 HRESULT E_FAIL已从调用COM组件返回。
如果我按下按钮打开文件,文件打开没有问题所以我想问题是从HandleDownloadAsync调用OpenNow()。
有人可以解释一下我的问题是什么吗?
private async void HandleDownloadAsync(DownloadOperation download, bool start)
{
Progress<DownloadOperation> progressCallback = new Progress<DownloadOperation>(ProgressCallback);
await download.StartAsync().AsTask(cts.Token, progressCallback);
ResponseInformation response = download.GetResponseInformation();
OpenNow();
}
private async void OpenNow()
{
try
{
StorageFile fileToLaunch = await KnownFolders.PicturesLibrary.GetFileAsync(medNameChosen + ".pdf");
if (destinationFile.ToString() != null)
{
await Windows.System.Launcher.LaunchFileAsync(fileToLaunch);
}
}
catch (Exception ex)
{
Debug.WriteLine("Error Open Donwloaded File: {0}", ex);
}
}