From c6b2cf87563ddd6d1cb7114de46831e91f9b9472 Mon Sep 17 00:00:00 2001 From: rportet Date: Fri, 7 Jun 2024 08:56:53 +0200 Subject: [PATCH] fix the navigation in gameboard --- Qwirkle/QwirkleViews/App.xaml.cs | 1 + Qwirkle/QwirkleViews/MainPage.xaml.cs | 2 +- Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs | 6 +++++- Qwirkle/QwirkleViews/Pages/Gameboard.xaml | 1 + Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs | 4 ++-- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Qwirkle/QwirkleViews/App.xaml.cs b/Qwirkle/QwirkleViews/App.xaml.cs index bb478eb..62a72ef 100644 --- a/Qwirkle/QwirkleViews/App.xaml.cs +++ b/Qwirkle/QwirkleViews/App.xaml.cs @@ -22,6 +22,7 @@ namespace Qwirkle MainPage = new AppShell(); Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers)); + Routing.RegisterRoute(nameof(Settings), typeof(Settings)); Routing.RegisterRoute(nameof(Gameboard), typeof(Gameboard)); Routing.RegisterRoute(nameof(Rules), typeof(Rules)); Routing.RegisterRoute(nameof(MainPage), typeof(MainPage)); diff --git a/Qwirkle/QwirkleViews/MainPage.xaml.cs b/Qwirkle/QwirkleViews/MainPage.xaml.cs index e4bfe0f..fe69cba 100644 --- a/Qwirkle/QwirkleViews/MainPage.xaml.cs +++ b/Qwirkle/QwirkleViews/MainPage.xaml.cs @@ -20,7 +20,7 @@ namespace Qwirkle { DisplayAlert("Game notification", "Enter minimun 2 player and max 4 player !", "Ok ! Lets's go !"); - Navigation.PushAsync(new SetPlayers()); + Shell.Current.GoToAsync("SetPlayers"); } public async void OnContinueClicked(object sender, EventArgs e) diff --git a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs index 8ef0e46..12fe4ec 100644 --- a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs +++ b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs @@ -242,7 +242,11 @@ public partial class Gameboard : ContentPage private void OnButtonBookClicked(object? sender, EventArgs e) { - Navigation.PushAsync(new Rules()); + Shell.Current.GoToAsync("Rules"); + } + private void OnButtonSettingsClicked(object? sender, EventArgs e) + { + Shell.Current.GoToAsync("Settings"); } diff --git a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml index da93ebb..4a762c4 100644 --- a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml +++ b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml @@ -61,6 +61,7 @@ HorizontalOptions="Start" Grid.Row="2" Grid.Column="1" Text="Settings" + Clicked="OnButtonSettingsClicked" ToolTipProperties.Text="Click to check your settings -_-" Style="{StaticResource GameButton}" /> diff --git a/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs b/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs index 4c5cb4f..e843be3 100644 --- a/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs +++ b/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs @@ -53,8 +53,8 @@ public partial class SetPlayers : ContentPage game.StartGame(); game.GiveTilesToPlayers(); game.SetNextPlayer(); - Navigation.PushAsync(new Gameboard()); - + Shell.Current.GoToAsync("Gameboard"); + } game.PlayerAddNotified -= Game_PlayerAddNotified;