Monday 15 February 2010

c# - Load File as storagefile from Local drive (resource) -


I am developing the Windows 8 app using C #. Here I am using FilePicker from the location I want, I know the path of the file that I had selected from local drive.

I want to use the file as a storage file.

  Storage File Newfile = Waiting for Windows Application model Package. Present. Place established. GetFileAsync (path); // path file paths are waiting for the storagefile file = known folders. Picture Library GetFileAsync (path);   

But this is just where my project is located & amp; Anyone else can give me the right path for the load file from the picture library.

Thank you.

WinRT GetFileFromPathAsync () class StorageFile Method, but you can not open a file with that method. You have the only option which is to use the StorageItemMostRecentlyUsedList class. Useful for the use of the StorageApplicationPermissions class to save the token accessed for all files that were either saved or saved from FileOpenPicker Have to do. How do I save the token for a file here? How & amp; Access the file to retrieve the token for

To save a token

  file open picture open picture = new file open picture (); OpenPicker.ViewMode = PickerViewMode.Thumbnail; OpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; OpenPicker.FileTypeFilter.Add ("jpg."); OpenPicker.FileTypeFilter.Add ("jpeg."); OpenPicker.FileTypeFilter.Add (".png"); Wait for StorageFile file = open picture. PixxingfileSync (); If (file! = Null) {// Add to the most recently used list with metadata (for example, string represents a string) string mruToken = Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList Add (file, "20130622"); // add metadata to the future access list without string. FaToken = Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Add (file); } Else {// file was not sacked for saving the file picker}   

to retrieve the file using a token

archiveMost recently used linksMRU = new archivesThe most recently used list ();

storage file file = wait MRU.GetFileAsync (token);

UPDATE

  Wait StorageApplicationPermissions .MostRecentlyUsedList.GetFileAsync (Token);    

No comments:

Post a Comment