File tree Expand file tree Collapse file tree 7 files changed +33
-6
lines changed
Expand file tree Collapse file tree 7 files changed +33
-6
lines changed Original file line number Diff line number Diff line change 11<Project >
22 <PropertyGroup >
33 <Nullable >enable</Nullable >
4- <AvaloniaVersion >11.3.2 </AvaloniaVersion >
4+ <AvaloniaVersion >11.3.3 </AvaloniaVersion >
55 </PropertyGroup >
66</Project >
Original file line number Diff line number Diff line change 138138 <data name =" AboutView.VocupOnGithub" xml : space =" preserve" >
139139 <value >Vocup auf GitHub</value >
140140 </data >
141+ <data name =" VhfFileType" xml : space =" preserve" >
142+ <value >Vocup Vokabelheft</value >
143+ </data >
141144</root >
Original file line number Diff line number Diff line change 138138 <data name =" AboutView.VocupOnGithub" xml : space =" preserve" >
139139 <value >Vocup op GitHub</value >
140140 </data >
141+ <data name =" VhfFileType" xml : space =" preserve" >
142+ <value >Vocup Woordenboek</value >
143+ </data >
141144</root >
Original file line number Diff line number Diff line change 138138 <data name =" AboutView.VocupOnGithub" xml : space =" preserve" >
139139 <value >Vocup on GitHub</value >
140140 </data >
141+ <data name =" VhfFileType" xml : space =" preserve" >
142+ <value >Vocup vocabulary book</value >
143+ </data >
141144</root >
Original file line number Diff line number Diff line change @@ -13,21 +13,26 @@ public MainView()
1313
1414 TopLevel . SetAutoSafeAreaPadding ( this , true ) ;
1515
16- this . WhenActivated ( d => d ( ViewModel . PickFileInteraction . RegisterHandler ( async interaction =>
16+ // ViewModel must be set before control activation
17+ this . WhenActivated ( d => d ( ViewModel ! . PickFileInteraction . RegisterHandler ( async interaction =>
1718 {
18- var files = await TopLevel . GetTopLevel ( this ) . StorageProvider . OpenFilePickerAsync ( new ( )
19+ // This control must be assinged to a TopLevel when it is activated
20+ var files = await TopLevel . GetTopLevel ( this ) ! . StorageProvider . OpenFilePickerAsync ( new ( )
1921 {
2022 AllowMultiple = false ,
23+ FileTypeFilter = [ new ( Lang . Resources . VhfFileType ) { Patterns = [ "*.vhf" ] } ]
2124 } ) ;
2225 if ( files . Count > 0 )
2326 interaction . SetOutput ( files [ 0 ] ) ;
2427 else
2528 interaction . SetOutput ( null ) ;
2629 } ) ) ) ;
2730
28- this . WhenActivated ( d => d ( ViewModel . FileFromUriInteraction . RegisterHandler ( async interaction =>
31+ // ViewModel must be set before control activation
32+ this . WhenActivated ( d => d ( ViewModel ! . FileFromUriInteraction . RegisterHandler ( async interaction =>
2933 {
30- var file = await TopLevel . GetTopLevel ( this ) . StorageProvider . TryGetFileFromPathAsync ( interaction . Input ) ;
34+ // This control must be assinged to a TopLevel when it is activated
35+ var file = await TopLevel . GetTopLevel ( this ) ! . StorageProvider . TryGetFileFromPathAsync ( interaction . Input ) ;
3136 interaction . SetOutput ( file ) ;
3237 } ) ) ) ;
3338 }
Original file line number Diff line number Diff line change 66 xmlns : views =" clr-namespace:Vocup.Views"
77 mc : Ignorable =" d" d : DesignWidth =" 800" d : DesignHeight =" 450"
88 x : Class =" Vocup.Views.MainWindow"
9+ x : DataType =" vm:MainViewModel"
910 Icon =" /Assets/square-logo.ico"
1011 Title =" Vocup" >
11- <views : MainView />
12+ <Design .DataContext>
13+ <vm : MainViewModel />
14+ </Design .DataContext>
15+ <views : MainView DataContext =" {Binding}" />
1216</Window >
You can’t perform that action at this time.
0 commit comments