2012-12-20 6 views
0

아래 코드에서 파일을 선택하는 데 문서 폴더가 표시되지 않습니다. 기능이 올바르게 설정되었습니다 (생각합니다). 그렇지 않으면 예외가 발생합니다. 중단 점을 설정하면 코드가 기다리는 명령문에 도달했으나 거기에 앉아서 아무 일도 일어나지 않습니다.Documents 폴더가 Windows Store 응용 프로그램에서 열리지 않는 이유는 무엇입니까?

... XAML

If ApplicationView.Value = ApplicationViewState.Snapped AndAlso ApplicationView.TryUnsnap = False Then 

하여 문제가 해결된다 :

<Page 
    x:Class="HandEditor.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:HandEditor" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"> 

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> 
     <Grid.RowDefinitions> 
      <RowDefinition/> 
      <RowDefinition/> 
     </Grid.RowDefinitions> 
     <Button Click="Button_Click_1">Choose .pbn file</Button> 
     <TextBlock Grid.Row="1" Text="{Binding StatusMessage}"/> 
    </Grid> 
</Page> 

답변

2

이게

Private Async Function Button_Click_1(sender As Object, e As RoutedEventArgs) As Task 
     If ApplicationView.TryUnsnap = False Then 
      StatusMessage = "Cannot unsnap." 
      Exit Function 
     End If 
     Dim filePicker As New FileOpenPicker 
     filePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary 
     filePicker.ViewMode = PickerViewMode.Thumbnail 
     filePicker.FileTypeFilter.Add(".pbn") 
     Dim pbnFile = Await filePicker.PickSingleFileAsync 
     If pbnFile IsNot Nothing Then 
      StatusMessage = pbnFile.Path 
     End If 
End Function 

EDIT : 방법에서 첫 번째 행은 이상이어야 call to unsnap is failing입니다.

앱을 찍은 다음 예상대로 작동합니다. 종료 기능 부분을 제거하면 예상대로 작동합니다.