1111using Windows . UI . ViewManagement ;
1212using Windows . UI . Xaml ;
1313using Windows . UI . Xaml . Controls ;
14+ using Windows . UI . Xaml . Navigation ;
1415
1516namespace Files
1617{
@@ -20,6 +21,7 @@ namespace Files
2021 public sealed partial class InstanceTabsView : Page
2122 {
2223 public static TabView tabView ;
24+ public string navArgs ;
2325 public InstanceTabsView ( )
2426 {
2527 this . InitializeComponent ( ) ;
@@ -56,19 +58,34 @@ public InstanceTabsView()
5658 titleBar . ButtonHoverBackgroundColor = Color . FromArgb ( 75 , 155 , 155 , 155 ) ;
5759 //titleBar.BackgroundColor = Colors.Transparent;
5860 }
59- AddNewTab ( typeof ( ProHome ) , "Start" ) ;
61+
62+ }
63+
64+ protected override void OnNavigatedTo ( NavigationEventArgs eventArgs )
65+ {
66+ navArgs = eventArgs . Parameter ? . ToString ( ) ;
67+
68+ if ( string . IsNullOrEmpty ( navArgs ) )
69+ {
70+ AddNewTab ( typeof ( ProHome ) , "Start" ) ;
71+ }
72+ else
73+ {
74+ AddNewTab ( typeof ( ProHome ) , navArgs ) ;
75+ }
76+
6077 Microsoft . UI . Xaml . Controls . FontIconSource icon = new Microsoft . UI . Xaml . Controls . FontIconSource ( ) ;
6178 icon . Glyph = "\xE713 " ;
6279 if ( ( tabView . SelectedItem as TabViewItem ) . Header . ToString ( ) != "Settings" && ( tabView . SelectedItem as TabViewItem ) . IconSource != icon )
6380 {
6481 App . selectedTabInstance = ItemViewModel . GetCurrentSelectedTabInstance < ProHome > ( ) ;
6582 }
6683 }
67-
84+
6885 public void AddNewTab ( Type t , string path )
6986 {
7087 Frame frame = new Frame ( ) ;
71- frame . Navigate ( t , path ) ;
88+ // frame.Navigate(t, path);
7289 string tabLocationHeader = null ;
7390 Microsoft . UI . Xaml . Controls . FontIconSource fontIconSource = new Microsoft . UI . Xaml . Controls . FontIconSource ( ) ;
7491 Microsoft . UI . Xaml . Controls . IconSource tabIcon ;
@@ -154,6 +171,10 @@ public void AddNewTab(Type t, string path)
154171 } ;
155172 tabView . TabItems . Add ( tvi ) ;
156173 TabStrip . SelectedItem = TabStrip . TabItems [ TabStrip . TabItems . Count - 1 ] ;
174+ if ( tabView . SelectedItem == tvi )
175+ {
176+ ( ( ( tabView . SelectedItem as TabViewItem ) . Content as Grid ) . Children [ 0 ] as Frame ) . Navigate ( t , path ) ;
177+ }
157178 }
158179
159180 public async void SetSelectedTabInfo ( string text , string currentPathForTabIcon = null )
@@ -249,7 +270,7 @@ private void DragArea_Loaded(object sender, RoutedEventArgs e)
249270 Window . Current . SetTitleBar ( sender as Grid ) ;
250271 }
251272
252- private void TabStrip_SelectionChanged ( object sender , SelectionChangedEventArgs e )
273+ public void TabStrip_SelectionChanged ( object sender , SelectionChangedEventArgs e )
253274 {
254275 if ( TabStrip . SelectedItem == null )
255276 {
0 commit comments