From ad0e5be7255ce2fdb25c2675c0f660e99b013d79 Mon Sep 17 00:00:00 2001 From: rportet Date: Fri, 7 Jun 2024 13:33:21 +0200 Subject: [PATCH 1/3] test for the app.xaml --- Qwirkle/QwirkleViews/App.xaml.cs | 1 + Qwirkle/QwirkleViews/MainPage.xaml.cs | 1 + Qwirkle/QwirkleViews/Views/GoBack.xaml.cs | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Qwirkle/QwirkleViews/App.xaml.cs b/Qwirkle/QwirkleViews/App.xaml.cs index bb478eb..a769596 100644 --- a/Qwirkle/QwirkleViews/App.xaml.cs +++ b/Qwirkle/QwirkleViews/App.xaml.cs @@ -19,6 +19,7 @@ namespace Qwirkle InitializeComponent(); + //MainPage = new NavigationPage(new MainPage()); MainPage = new AppShell(); Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers)); diff --git a/Qwirkle/QwirkleViews/MainPage.xaml.cs b/Qwirkle/QwirkleViews/MainPage.xaml.cs index e4bfe0f..3c55466 100644 --- a/Qwirkle/QwirkleViews/MainPage.xaml.cs +++ b/Qwirkle/QwirkleViews/MainPage.xaml.cs @@ -20,6 +20,7 @@ namespace Qwirkle { DisplayAlert("Game notification", "Enter minimun 2 player and max 4 player !", "Ok ! Lets's go !"); + Navigation.PushAsync(new SetPlayers()); } diff --git a/Qwirkle/QwirkleViews/Views/GoBack.xaml.cs b/Qwirkle/QwirkleViews/Views/GoBack.xaml.cs index cc77872..b157937 100644 --- a/Qwirkle/QwirkleViews/Views/GoBack.xaml.cs +++ b/Qwirkle/QwirkleViews/Views/GoBack.xaml.cs @@ -9,8 +9,8 @@ public partial class GoBack : ContentView InitializeComponent(); } - private async void Button_OnClicked(object? sender, EventArgs e) + private void Button_OnClicked(object? sender, EventArgs e) { - await Navigation.PopToRootAsync(); + Navigation.PopAsync(); } } \ No newline at end of file From 6ea1bdc7f056c4cdde23378255c232958cfefd2d Mon Sep 17 00:00:00 2001 From: rportet Date: Fri, 7 Jun 2024 13:34:36 +0200 Subject: [PATCH 2/3] j'ai push le mauvais truc mdrr --- Qwirkle/QwirkleViews/App.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Qwirkle/QwirkleViews/App.xaml.cs b/Qwirkle/QwirkleViews/App.xaml.cs index a769596..f1963c6 100644 --- a/Qwirkle/QwirkleViews/App.xaml.cs +++ b/Qwirkle/QwirkleViews/App.xaml.cs @@ -19,8 +19,8 @@ namespace Qwirkle InitializeComponent(); - //MainPage = new NavigationPage(new MainPage()); - MainPage = new AppShell(); + MainPage = new NavigationPage(new MainPage()); + //MainPage = new AppShell(); Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers)); Routing.RegisterRoute(nameof(Gameboard), typeof(Gameboard)); From 0a34f4bc435e431282a8910ccb13fe95ec83c18b Mon Sep 17 00:00:00 2001 From: rportet Date: Fri, 7 Jun 2024 14:21:25 +0200 Subject: [PATCH 3/3] now goBack fucking works ! better dirty than not working --- Qwirkle/QwirkleViews/App.xaml.cs | 4 ++-- Qwirkle/QwirkleViews/MainPage.xaml.cs | 7 ++++--- Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs | 5 +++++ Qwirkle/QwirkleViews/Pages/Gameboard.xaml | 1 + Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs | 3 ++- Qwirkle/QwirkleViews/Pages/Settings.xaml.cs | 5 ----- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Qwirkle/QwirkleViews/App.xaml.cs b/Qwirkle/QwirkleViews/App.xaml.cs index f1963c6..a769596 100644 --- a/Qwirkle/QwirkleViews/App.xaml.cs +++ b/Qwirkle/QwirkleViews/App.xaml.cs @@ -19,8 +19,8 @@ namespace Qwirkle InitializeComponent(); - MainPage = new NavigationPage(new MainPage()); - //MainPage = new AppShell(); + //MainPage = new NavigationPage(new MainPage()); + MainPage = new AppShell(); Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers)); Routing.RegisterRoute(nameof(Gameboard), typeof(Gameboard)); diff --git a/Qwirkle/QwirkleViews/MainPage.xaml.cs b/Qwirkle/QwirkleViews/MainPage.xaml.cs index 3c55466..f5e3ed7 100644 --- a/Qwirkle/QwirkleViews/MainPage.xaml.cs +++ b/Qwirkle/QwirkleViews/MainPage.xaml.cs @@ -20,8 +20,8 @@ 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"); + //Navigation.PushAsync(new SetPlayers()); } public async void OnContinueClicked(object sender, EventArgs e) @@ -30,7 +30,8 @@ namespace Qwirkle try { ((App)Application.Current!).Game = gameLoad.LoadGame(); - await Navigation.PushAsync(new Gameboard()); + await Shell.Current.GoToAsync("Gameboard"); + //await Navigation.PushAsync(new Gameboard()); } catch { diff --git a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs index b3eb3e0..af80d46 100644 --- a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs +++ b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs @@ -252,5 +252,10 @@ public partial class Gameboard : ContentPage Navigation.PushAsync(new Rules()); } + private void OnButtonSettingsClicked(object? sender, EventArgs e) + { + Navigation.PushAsync(new Settings()); + } + } diff --git a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml index d1d4b34..1413b28 100644 --- a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml +++ b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml @@ -62,6 +62,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 9bcced0..b029414 100644 --- a/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs +++ b/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs @@ -53,7 +53,8 @@ public partial class SetPlayers : ContentPage game.StartGame(); game.GiveTilesToPlayers(); game.SetNextPlayer(); - Navigation.PushAsync(new Gameboard()); + Shell.Current.GoToAsync("Gameboard"); + //Navigation.PushAsync(new Gameboard()); } diff --git a/Qwirkle/QwirkleViews/Pages/Settings.xaml.cs b/Qwirkle/QwirkleViews/Pages/Settings.xaml.cs index 90515bf..aa7a7fd 100644 --- a/Qwirkle/QwirkleViews/Pages/Settings.xaml.cs +++ b/Qwirkle/QwirkleViews/Pages/Settings.xaml.cs @@ -6,9 +6,4 @@ public partial class Settings : ContentPage { InitializeComponent(); } - - public void OnGoBackClicked(object sender, EventArgs e) - { - Navigation.PopAsync(); - } } \ No newline at end of file