1
1
#nullable enable
2
2
3
- using CommunityToolkit . Mvvm . DependencyInjection ;
4
- using Screenbox . Core ;
5
- using Screenbox . Core . ViewModels ;
6
3
using System ;
7
4
using System . Collections . Generic ;
8
5
using System . Linq ;
6
+ using CommunityToolkit . Mvvm . DependencyInjection ;
7
+ using Screenbox . Core ;
8
+ using Screenbox . Core . Services ;
9
+ using Screenbox . Core . ViewModels ;
10
+ using Screenbox . Helpers ;
9
11
using Windows . UI . Xaml . Controls ;
10
12
using Windows . UI . Xaml . Media . Animation ;
11
13
using Windows . UI . Xaml . Navigation ;
12
14
using NavigationView = Microsoft . UI . Xaml . Controls . NavigationView ;
13
15
using NavigationViewSelectionChangedEventArgs = Microsoft . UI . Xaml . Controls . NavigationViewSelectionChangedEventArgs ;
16
+ using muxc = Microsoft . UI . Xaml . Controls ;
14
17
15
18
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
16
19
@@ -33,6 +36,8 @@ public sealed partial class VideosPage : Page, IContentFrame
33
36
34
37
private readonly Dictionary < string , Type > _pages ;
35
38
39
+ private ISettingsService Settings => Ioc . Default . GetRequiredService < ISettingsService > ( ) ;
40
+
36
41
public VideosPage ( )
37
42
{
38
43
this . InitializeComponent ( ) ;
@@ -56,7 +61,20 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
56
61
}
57
62
else
58
63
{
59
- LibraryNavView . SelectedItem = LibraryNavView . MenuItems [ 0 ] ;
64
+ muxc . NavigationViewItem ? libraryNavItem = null ;
65
+ var launchPage = Settings . LaunchPage ;
66
+ if ( launchPage . GetNavPageFirstLevel ( ) != "videos" )
67
+ {
68
+ libraryNavItem = ( muxc . NavigationViewItem ? ) LibraryNavView . MenuItems [ 0 ] ;
69
+ }
70
+ else
71
+ {
72
+ var launchPageTag = launchPage . GetNavPageSecondLevel ( ) ;
73
+ libraryNavItem = LibraryNavView . MenuItems
74
+ . OfType < muxc . NavigationViewItem > ( )
75
+ . FirstOrDefault ( item => item . Tag ? . ToString ( ) == launchPageTag ) ;
76
+ }
77
+ LibraryNavView . SelectedItem = libraryNavItem ?? LibraryNavView . MenuItems [ 0 ] ;
60
78
}
61
79
62
80
ViewModel . UpdateVideos ( ) ;
0 commit comments