Wpf:
New".txt"; Nullable<bool> result = dlg. ShowDialog (); if true ) { // string filename = dlg. FileName;}
New FileStream (filename, filemode.open); New StreamReader (Afile);
A using System.Windows.Documents is required; Using System.IO;
Windows app:
New= pickerviewmode.list;
= Pickerlocationid.desktop;
OPENPICKER.FILETYPEFILTER.ADD (".txt"await Openpicker.picksinglefileasync ();
string filename ==ss.file;
var await Fileio.readlinesasync (file);
Need:
Using Windows.storage;
Using Windows.Storage.Pickers;
Using System.Collections;
Windows Phone:
New== pickerlocationid.desktop;openpicker.filetypefilter.add (".txt "); Openpicker.picksinglefileandcontinue ();
voidmainpage_activated (coreapplicationview sender, Windows.ApplicationModel.Activation.IActivatedEventArgs args) { Fileopenpickercontinuationeventargs Continueargs= args asFileopenpickercontinuationeventargs; if(Continueargs! =NULL) {Ss.file= continueargs.files[0]; if(Ss.file! =NULL) {BlankPage1 pg1=NewBlankPage1 (); SS.BL=true; Frame.navigate (typeof(BlankPage1)); } Else { } }}
string filename == MainPage.ss.file; var await Fileio.readlinesasync (file);
Need:
Using Windows.storage;
Using Windows.Storage.Pickers;
Using Windows.ApplicationModel.Core;
Using Windows.ApplicationModel.Activation;
Using System.Collections;
File Selection method on C # three platforms