【发布时间】:2017-08-22 20:33:10
【问题描述】:
我有一个 Xamarin Forms 项目,我需要用户能够在其中“加载”图像。我已经可以按下按钮并使用 FilePicker 搜索文件,如下所示:
async void OnUpload(object sender, EventArgs e)
{
try
{
FileData filedata = await CrossFilePicker.Current.PickFile();
// the dataarray of the file will be found in filedata.DataArray
// file name will be found in filedata.FileName;
//etc etc.
}
catch (Exception ex)
{
}
}
我现在需要将该“文件数据”(图像)复制到项目的资源文件夹中,以便轻松访问该文件。我试过了:
await CrossFilePicker.Current.SaveFile(filedata.FileName);
但它不会将任何文件保存到项目文件夹中。 而且,我只需要它在 UWP 和 Android 上工作。
【问题讨论】:
标签: android xamarin uwp xamarin.forms filepicker