Reputation: 11
all
Use windows phone 8.0, this method was well,can launch files.
Windows.System.Launcher.LaunchFileAsync(localFile);
But , in windows phone 8.1 , this method was wrong: "Error HRESULT E_FAIL has been returned from a call to a COM component."
Please help.
Upvotes: 1
Views: 323
Reputation: 11
I had the same problem, here is the solution i found out:
Deployment.Current.Dispatcher.BeginInvoke(async () =>
{
var uri = new System.Uri("ms-appdata:///local/"+fileName);
StorageFile file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);
if (file != null)
{
await Windows.System.Launcher.LaunchFileAsync(file);
}
});
Upvotes: 1