Windows Store App Recent access list

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.