c# - Launch file from isolated storage in Windows Phone 8.1 -
- This separate storage
- Launched with the default app
-
I have done all the code very well, even opening the ".pdf, .txt" document Save to, but its contents are not visible, it remains empty In case of ".docx", I get this message:
"Documents are damaged. Obtained and could not be opened "
Please see below my code:
string file =" abc.pdf "; Uri Uri = new Uri ("https://www.abc.com/abcd/getDocument"); Webclient wc = new webclient (); Wc.OpenReadAsync (URI); Wc.OpenReadCompleted + = wc_OpenReadCompleted; Async zero wc_OpenReadCompleted (object sender, OpenReadCompletedEventArgs e) {byte [buffer = new byte [e.Result.Length]; E.Result.ReadAsync (wait for buffer, 0, (int. Buffer)); Using (IsolatedStorageFile storageFile = IsolatedStorageFile.GetUserStoreForApplication ()) using {(IsolatedStorageFileStream Section = storageFile.OpenFile (file, FileMode.Create)) wait {stream.WriteAsync (buffer, 0, buffer.Length); Stream.Flush (); }} StorageFolder Local = Windows.Storage.ApplicationData.Current.LocalFolder; StorageFile pdffile = Wait for the local. GetFileAsync (file); // Launch the PDF file awaiting Windows.System.Launcher.LaunchFileAsync (pdffile); }
Your URI is not correct. Try to use the correct URI This is the only problem you can verify by tilting the URI used in the browser. It does not exist.
, using the same related extensions for all files such as .pdf for the PDF file to docx file using .docx extension
Comments
Post a Comment