简体   繁体   English

在Windows 10通用应用程序中保存FolderPicker位置以供下次使用c#

[英]Save FolderPicker location for next time in windows 10 universal apps c#

I am getting file by using FolderPicker from device, by using this below code. 我通过使用以下代码从设备使用FolderPicker获取文件。

FolderPicker pk = new FolderPicker();

        pk.SuggestedStartLocation = PickerLocationId.Downloads;
        pk.ViewMode = PickerViewMode.Thumbnail;
        pk.FileTypeFilter.Add("*");

        var folder = await pk.PickSingleFolderAsync();

        var files =await folder.GetFilesAsync();

        foreach (var files in files)
        {

        }

For each time i have to pick the folder location, for that reason i want to save the folder location first time, when i open app next time get the file from that path, any one please help me to achieve this. 每次我必须选择文件夹位置,因此我想第一次保存文件夹位置,当我下次打开应用程序从该路径获取文件时,任何人请帮助我实现这一点。

Thank you, 谢谢,

Use the FolderPicker.SettingsIdentifier for that. 使用FolderPicker.SettingsIdentifier If you set the value to something like "My Downloads" then the next time you use the picker, it will start in the location you picked previously. 如果您将值设置为“我的下载”,则下次使用选择器时,它将从您之前选择的位置开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM