Windows 8 when the system manages the user's files, the files that the user accesses recently are added to the recent access list of the corresponding app, all Windows store apps have their own list of recent visits, and depending on the last access time of the file, you can sort the files in the list and the number of access items in the list exceeds - Deletes the oldest access item.
in the recent access list (mostrecentlyusedlist, hereinafter referred to asMRUlist), the implementation is stored in theIstorageitemobject for the class of the interface, and therefore represents the file'sStorageFileclass and the object that represents the folder.Storagefolderobject of the class can be added to theMRUthe list.
If you want to add a recent access item to theMRUlist, you need to first pass thestorageapplicationpermissionsClass ofmostrecentlyusedlistProperty getsMRUlist, and then call the parameter with the corresponding optional metadata for the stored item that you want to add to the listADDmethod to implement, the storage item that needs to be added refers to theStorageFileobject of the class orStoragefolderclass, and the metadata is a string type that is used to describe the stored items in the list. The sample code looks like this:
String Mrutoken = WINDOWS.STORAGE.ACCESSCACHE.STORAGEAPPLICATIONPERMISSIONS.MOSTRECENTLYUSEDLIST.ADD ( Pickedfile, " my picture ");
The code assumes that a picture has been selected through the file picker described above, and the that represents this image is obtained. pickedfile add pickedfile object added to mru
add file to mru add mru list to retrieve and get the files or folders stored in it. The following sample code is obtained through the above markup mrutoken Get the file corresponding to it.
storagefile retrievedfile = await Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList.GetFileAsync (Mrutoken);
< Span style= "font-family:; mso-ascii-font-family: "times New roman" "> If you want to get mru list, you can use Class entries token property gets the tag for each list item separately, and the corresponding file or folder is obtained by tag, as shown in the example code:
Accesslistentryview mruentries = StorageApplicationPermissions.MostRecentlyUsedList.Entries;
if (Mruentries.count > 0)
{
foreach (Accesslistentry entry in mruentries)
{
// Get token
String token = entry. Token;
//todo: get a file or folder
var listItem = StorageApplicationPermissions.MostRecentlyUsedList.GetItemAsync (token);
}
}
Else
{
/ / processing of an empty MRU list
}
Windows Store App Recent access list