Windows Store App JavaScript Development: File Picker

Source: Internet
Author: User

as in the previous chaptersC #As described in the language, the file picker is an interface in which applications interact with the system, and the file picker can interact directly with the file system in the app, Access files or folders in different locations, or store files in a specified location. The file picker is divided into the picker that operates on the file and the picker that operates on the folder. The picker that operates on the file contains the file open Picker and the file Save picker, and the file Open Picker is created by theFileopenpickerclass, which is used to select or open a file, and the file Save Picker isFilesavepickerclass that is used to save the file to the specified file system location. The picker that operates on a folder is determined by theFolderpickerclass that is used to pick a folder. These three classes are located in theWindows.Storage.Pickersnamespace.

For the above three types of file pickers, the Picker interface contains the following:

q start position: The initial file system location.

q drop-down symbol: Click the drop-down symbol to select a different file system location from the drop-down list, such as document library, desktop, computer, and so on.

q Return to the previous level: used to return to the parent directory.

q sort: Sort items under a file system location, including sorting by date and sorting by name.

q Project list: All items under the file system location.

When you need to invoke a file picker in your application, you first need to determine whether the application can display it, judging by windows.ui.viewmanagement.applicationview.value Gets the current state of the application, if the application is in snap state, and through function cannot display the file picker :

function OpenFile () {

var currentstate = Windows.UI.ViewManagement.ApplicationView.value;/* get the current state of the application*/

    if (currentstate = = = Windows.UI.ViewManagement.ApplicationViewState.snapped &&

        ! Windows.UI.ViewManagement.ApplicationView.tryUnsnap ()) {

return;  /*if the application is in a snap state and cannot be canceled, the file picker cannot be displayed, and the function returns directly without performing the following actions*/

    }

    //To create a File Open Picker object

    var filepicker = new Windows.Storage.Pickers.FileOpenPicker ();

    //set the view mode of the file Open picker

    filepicker.viewmode = Windows.Storage.Pickers.PickerViewMode.list;

}

Windows Store App JavaScript Development: File Picker

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.