How do I have to close a document? Because if I open the same pdf-file twice I get an System.UnauthorizedAccessException. (Doc A --> Doc B works, but Doc A --> Doc A crashes).
The crash happens on StorageFile.GetFileFromPathAsync(path) because the file is still open.
Here is my Code
private async void OpenPage(String path)
{
StorageFile file = await StorageFile.GetFileFromPathAsync(path);
if (file != null)
{
IRandomAccessStream stream = await
file.OpenAsync(FileAccessMode.ReadWrite);
if (doc != null) {
doc.Dispose();
}
doc = new pdftron.PDF.PDFDoc(stream);
MyPDFViewCtrl.SetDoc(doc);
}
}