Windows Phone 8 choose text file C# -


i have question. if there possibility @ windows phone 8 @ visual studio create button event read text file? know streamreader , if declare wchich exacly file want read, if want choose list of files wchich want display. did research on internet didint find answer. know can use isolatedstorage read music, video, image not text files, on app created few files text in , want users have posibility display 1 file, whichever want see. so, can tell me how this?

you can use isolatedstorage read file type wish. must of been using launcher filters out file type based on chooser.

you can open file this:

private async task<string> readtextfile(string file_name) {     // return buffer     string file_content = "";      // local folder     storagefolder local = windows.storage.applicationdata.current.localfolder;      if (local != null)     {         // file         storagefile file;         try         {             file = await local.getfileasync(file_name);         }         catch (exception ex)         {             // no file, return empty             return file_content;         }          // stream         system.io.stream file_stream = await file.openstreamforreadasync();          // read data         using (streamreader streamreader = new streamreader(file_stream))         {            file_content = streamreader.readtoend();   // read full text file             streamreader.close();         }          // close stream         file_stream.close();     }      // return     return file_content; } 

if want packagelocation (files added project assets , images) replace localfolder with

windows.applicationmodel.package package = windows.applicationmodel.package.current; windows.storage.storagefolder installedlocation = package.installedlocation; 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -