storagefile

How to Delete Files and Application Data Container Values in One Go?

你。 提交于 2019-12-04 01:50:48
问题 I have a reset function in my app which brings the app back to default state. There for I need to remove the four files I created and remove the settings I created in the ApplicationDataContainer . This is how I remove the files try { StorageFile file = await localfolder.GetFileAsync("HistoryFile"); if (file != null) { await file.DeleteAsync(); } } catch { //Catch Process } Is there a function which removes all the files together? When I tried the following code localfolder.DeleteAsync() It

Launching PDF reader on windows phone 8

▼魔方 西西 提交于 2019-12-02 03:22:54
I'm trying to launch pdf reader with the code below but it does not work. Can somebody help me? private async Task<StorageFile> WriteData(string fileName, byte[] data) { StorageFolder folder = ApplicationData.Current.LocalFolder; StorageFile file = await folder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting); using (Stream s = await file.OpenStreamForWriteAsync()) { await s.WriteAsync(data, 0, data.Length); s.Close(); } return file; } private async Task<bool> OpenPdf(StorageFile file) { var uri = new Uri(file.Path, UriKind.RelativeOrAbsolute); bool result = await Windows

WinRT StorageFile write downloaded file

╄→尐↘猪︶ㄣ 提交于 2019-11-30 03:17:29
问题 I'm struggling with a easy problem. I want to download an image from web using this code: WebRequest requestPic = WebRequest.Create(@"http://something.com/" + id + ".jpg"); WebResponse responsePic = await requestPic.GetResponseAsync(); Now I wanted to write the WebResponse's stream in a StorageFile (eg. create a file id.jpg in the app's storage), but I haven't found any way to achieve that. I searched the web for it, but no success - all ways incompatible Stream types and so on. Could you