VB.net - Openfilepicker在Windows Mobile 10应用程序中不起作用

时间:2016-05-05 20:51:16

标签: vb.net win-universal-app windows-10-mobile

我正在开发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”。

1 个答案:

答案 0 :(得分:0)

这是我快速写的内容,它应该允许您访问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


如果您有任何问题,我会尽力帮助您,但是从您的问题所述,这应该是绰绰有余的。
快乐的编码!