This repository was archived by the owner on Apr 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Xamarin/BooksAppX/BooksAppX Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 157157 <Version >2.0.0</Version >
158158 </PackageReference >
159159 <PackageReference Include =" Xamarin.Forms" Version =" 2.5.0.122203" />
160- <PackageReference Include =" Microsoft.NETCore.UniversalWindowsPlatform" Version =" 6.0.1 " />
160+ <PackageReference Include =" Microsoft.NETCore.UniversalWindowsPlatform" Version =" 6.0.6 " />
161161 </ItemGroup >
162162 <ItemGroup >
163163 <ProjectReference Include =" ..\..\..\..\PatternsXamarinShared\BooksLib\BooksLib.csproj" >
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public App()
2323 protected override void OnStart ( )
2424 {
2525 // Handle when your app starts
26+ AppServices . GetService < INavigationService > ( ) . UseNavigation = true ; // always use navigation
2627 }
2728
2829 protected override void OnSleep ( )
Original file line number Diff line number Diff line change 44using Microsoft . Extensions . DependencyInjection ;
55using BooksAppX . Services ;
66using BooksLib . Services ;
7+ using Framework . Services ;
8+ using System . Threading . Tasks ;
79
810namespace BooksAppX . Views
911{
@@ -16,5 +18,16 @@ public MainPage ()
1618
1719 ( Application . Current as App ) . AppServices . GetService < XamarinInitializeNavigationService > ( ) . SetNavigation ( navigationPage . Navigation , PageNames . BooksPage ) ;
1820 }
21+
22+ protected override bool OnBackButtonPressed ( )
23+ {
24+ OnBackButtonAsync ( ) ;
25+ return true ;
26+ }
27+
28+ private async void OnBackButtonAsync ( )
29+ {
30+ await ( Application . Current as App ) . AppServices . GetService < INavigationService > ( ) . GoBackAsync ( ) ;
31+ }
1932 }
2033}
You can’t perform that action at this time.
0 commit comments