@@ -25,7 +25,8 @@ public SettingsBasePage(bool isManagers)
2525 this . InitializeComponent ( ) ;
2626 BackButton . Click += ( _ , _ ) =>
2727 {
28- if ( MainNavigationFrame . CanGoBack ) MainNavigationFrame . GoBack ( ) ;
28+ if ( MainNavigationFrame . Content is ManagersHomepage or SettingsHomepage ) MainApp . Instance . MainWindow . GoBack ( ) ;
29+ else if ( MainNavigationFrame . CanGoBack ) MainNavigationFrame . GoBack ( ) ;
2930 else MainNavigationFrame . Navigate ( isManagers ? typeof ( ManagersHomepage ) : typeof ( SettingsHomepage ) , null , new DrillInNavigationTransitionInfo ( ) ) ;
3031 } ;
3132 MainNavigationFrame . Navigated += MainNavigationFrame_Navigated ;
@@ -59,20 +60,16 @@ private void MainNavigationFrame_Navigated(object sender, NavigationEventArgs e)
5960 var page = e . Content as ISettingsPage ;
6061 if ( page is null ) throw new InvalidCastException ( "Settings page does not inherit from ISettingsPage" ) ;
6162
62- BackButton . Visibility = page . CanGoBack ? Visibility . Visible : Visibility . Collapsed ;
63- // AnnouncerBorder.Visibility = BackButton.Visibility is Visibility.Collapsed? Visibility.Visible : Visibility.Collapsed;
63+ BackButton . Visibility = Visibility . Visible ;
6464 SettingsTitle . Text = page . ShortTitle ;
6565 page . NavigationRequested += Page_NavigationRequested ;
6666 page . RestartRequired += Page_RestartRequired ;
6767 if ( page is PackageManagerPage pmpage ) pmpage . ReapplyProperties += SettingsBasePage_ReapplyProperties ;
68-
69- // Scroller.ChangeView(0, 0, 1, true);
7068 }
7169
7270 private void SettingsBasePage_ReapplyProperties ( object ? sender , EventArgs e )
7371 {
7472 BackButton . Visibility = ( ( MainNavigationFrame . Content as ISettingsPage ) ? . CanGoBack ?? true ) ? Visibility . Visible : Visibility . Collapsed ;
75- // AnnouncerBorder.Visibility = BackButton.Visibility is Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
7673 SettingsTitle . Text = ( MainNavigationFrame . Content as ISettingsPage ) ? . ShortTitle ?? "INVALID CONTENT PAGE!" ;
7774 }
7875
@@ -116,6 +113,9 @@ public bool CanGoBack()
116113 => MainNavigationFrame . CanGoBack && MainNavigationFrame . Content is not SettingsHomepage && MainNavigationFrame . Content is not ManagersHomepage ;
117114
118115 public void GoBack ( )
119- => MainNavigationFrame . GoBack ( ) ;
116+ {
117+ if ( CanGoBack ( ) ) MainNavigationFrame . GoBack ( ) ;
118+ else MainApp . Instance . MainWindow . GoBack ( ) ;
119+ }
120120 }
121121}
0 commit comments