我正在开发Windows 10 UWP和以下代码:
Dim wopk As FileOpenPicker = New FileOpenPicker
With wopk
.ViewMode = PickerViewMode.List
.SuggestedStartLocation = PickerLocationId.DocumentsLibrary
.FileTypeFilter.Add(".txt")
dim wfile = Await .PickSingleFileAsync()
End with
在我的Lumia 535(Windows Mobile 10)上崩溃,而没有错误消息(调试和运行时模式)。
出现初始屏幕并仍然挂起。
在桌面上,一切正常。
在包清单声明中,我为文件打开/保存选择器定义了“ .txt”扩展名。
该项目的目标为“ Windows 10”,版本为“ Build 10586”。
这是我很快写的东西,它应该允许您访问。openfilepicker
它不完整,但是应该引导您朝着正确的方向前进。
Imports Windows.Storage.Pickers
Public NotInheritable Class MainPage
Inherits Page
Private Async Sub button_Click(sender As Object, e As RoutedEventArgs) Handles button.Click
Dim openfilepicker = New FileOpenPicker
openfilepicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary
openfilepicker.FileTypeFilter.Add(".txt")
openfilepicker.CommitButtonText = "Open"
Dim Textfile = Await openfilepicker.PickSingleFileAsync()
If Textfile IsNot Nothing Then
Dim SelectedTextFile = Await Textfile.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite)
'Write your code here using SelectedTextFile as the source for the async.
End If
End Sub
End Class
如果您有任何问题,我会尽力为您提供帮助,但是从您的问题中指出,这已经足够了。
祝您编码愉快!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句