diff --git a/README.md b/README.md index 03c5d83..b1c14c9 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ ServiceResolver.Resolve(IExampleService); ``` ## Navigation service -`INavigationService` is automatically registered by `.UseBurkusMvvm(...)`. You can use it to: push pages, pop pages, pop to the root page, replace the top page of the app, reset the navigation stack, switch tabs, and more. +`INavigationService` is automatically registered by `.UseBurkusMvvm(...)`. You can use it to: push pages, pop pages, pop to the root page, go back, replace the top page of the app, reset the navigation stack, switch tabs, and more. See the [INavigationService interface in the repository](https://github.com/BurkusCat/Burkus.Mvvm.Maui/blob/main/src/Abstractions/INavigationService.cs) for all possible navigation method options. This is a simple navigation example where we push a "`TestPage`" onto the navigation stack: diff --git a/samples/DemoApp/Properties/Resources.Designer.cs b/samples/DemoApp/Properties/Resources.Designer.cs index 91fda21..77b1ef4 100644 --- a/samples/DemoApp/Properties/Resources.Designer.cs +++ b/samples/DemoApp/Properties/Resources.Designer.cs @@ -258,6 +258,15 @@ internal static string Home_Button_ChangeUsernameNoAnimation { } } + /// + /// Looks up a localized string similar to Exit. + /// + internal static string Home_Button_Exit { + get { + return ResourceManager.GetString("Home_Button_Exit", resourceCulture); + } + } + /// /// Looks up a localized string similar to Flyout Page demo. /// diff --git a/samples/DemoApp/Properties/Resources.resx b/samples/DemoApp/Properties/Resources.resx index 632ffa6..5735660 100644 --- a/samples/DemoApp/Properties/Resources.resx +++ b/samples/DemoApp/Properties/Resources.resx @@ -205,6 +205,10 @@ Change Username (no animation) Translate + + Exit + Translate + Flyout Page demo Translate diff --git a/samples/DemoApp/ViewModels/HomeViewModel.cs b/samples/DemoApp/ViewModels/HomeViewModel.cs index 2f0b504..677c780 100644 --- a/samples/DemoApp/ViewModels/HomeViewModel.cs +++ b/samples/DemoApp/ViewModels/HomeViewModel.cs @@ -145,5 +145,15 @@ private async Task GoToFlyoutPageDemo() await navigationService.Navigate($"{nameof(DemoFlyoutPage)}", navigationParameters); } + /// + /// Exit the application. + /// + [RelayCommand] + private async Task Exit() + { + // Pop the homepage off the stack, closing the app. + await navigationService.GoBack(); + } + #endregion Commands } diff --git a/samples/DemoApp/Views/HomePage.xaml b/samples/DemoApp/Views/HomePage.xaml index 658cac3..25c6353 100644 --- a/samples/DemoApp/Views/HomePage.xaml +++ b/samples/DemoApp/Views/HomePage.xaml @@ -65,6 +65,11 @@ Command="{Binding GoToFlyoutPageDemoCommand}" Style="{StaticResource PrimaryButton}" Text="{x:Static properties:Resources.Home_Button_FlyoutPageDemo}" /> +