From ee4626269e55e4346f3d2fcfbda913d5c216f502 Mon Sep 17 00:00:00 2001 From: besbota Date: Tue, 8 Apr 2025 11:46:40 +0200 Subject: [PATCH] Changement affichage --- MauiAppStock/App.xaml.cs | 2 +- MauiAppStock/AppShell.xaml | 15 ++++++++------- MauiAppStock/AppShell.xaml.cs | 15 ++++++++++++++- MauiAppStock/Views/AppareilPiecesPage.xaml | 4 +++- MauiAppStock/Views/EditPiecePage.xaml.cs | 2 +- MauiAppStock/Views/MainPage.xaml | 9 +++------ .../Views/SelectAppareilForAssociationPage.xaml | 1 + .../SelectAppareilForAssociationPage.xaml.cs | 8 +++++++- 8 files changed, 38 insertions(+), 18 deletions(-) diff --git a/MauiAppStock/App.xaml.cs b/MauiAppStock/App.xaml.cs index 7bb788a..f709f05 100644 --- a/MauiAppStock/App.xaml.cs +++ b/MauiAppStock/App.xaml.cs @@ -9,7 +9,7 @@ public partial class App : Application { InitializeComponent(); // On démarre sur MainPage dans une NavigationPage pour permettre la navigation - MainPage = new NavigationPage(new MainPage()); + MainPage = new AppShell(); InitializeDatabase(); } diff --git a/MauiAppStock/AppShell.xaml b/MauiAppStock/AppShell.xaml index bc2c2d4..16d2bb4 100644 --- a/MauiAppStock/AppShell.xaml +++ b/MauiAppStock/AppShell.xaml @@ -3,14 +3,15 @@ x:Class="MauiAppStock.AppShell" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:local="clr-namespace:MauiAppStock" xmlns:views="clr-namespace:MauiAppStock.Views" Shell.FlyoutBehavior="Disabled" Title="MauiAppStock"> - - - + + + + + + + + diff --git a/MauiAppStock/AppShell.xaml.cs b/MauiAppStock/AppShell.xaml.cs index 5a5c839..e0da968 100644 --- a/MauiAppStock/AppShell.xaml.cs +++ b/MauiAppStock/AppShell.xaml.cs @@ -1,9 +1,22 @@ -namespace MauiAppStock; +using MauiAppStock.Views; + +namespace MauiAppStock; public partial class AppShell : Shell { public AppShell() { InitializeComponent(); + Routing.RegisterRoute(nameof(MainPage), typeof(MainPage)); + Routing.RegisterRoute(nameof(AppareilsPage), typeof(AppareilsPage)); + Routing.RegisterRoute(nameof(PiecesPage), typeof(PiecesPage)); + Routing.RegisterRoute(nameof(SelectAppareilForAssociationPage), typeof(SelectAppareilForAssociationPage)); + } + protected override void OnNavigating(ShellNavigatingEventArgs args) + { + base.OnNavigating(args); + + bool isMainPage = args.Target?.Location?.OriginalString == "//MainPage"; + Shell.SetBackButtonBehavior(this, new BackButtonBehavior { IsVisible = !isMainPage }); } } \ No newline at end of file diff --git a/MauiAppStock/Views/AppareilPiecesPage.xaml b/MauiAppStock/Views/AppareilPiecesPage.xaml index 19bb339..d7e1899 100644 --- a/MauiAppStock/Views/AppareilPiecesPage.xaml +++ b/MauiAppStock/Views/AppareilPiecesPage.xaml @@ -15,7 +15,9 @@ + ItemTapped="OnAssociationTapped" + HasUnevenRows="True" + HeightRequest="500"> diff --git a/MauiAppStock/Views/EditPiecePage.xaml.cs b/MauiAppStock/Views/EditPiecePage.xaml.cs index 9283357..ae81cbc 100644 --- a/MauiAppStock/Views/EditPiecePage.xaml.cs +++ b/MauiAppStock/Views/EditPiecePage.xaml.cs @@ -25,7 +25,7 @@ namespace MauiAppStock.Views _piece.Description = DescriptionEditor.Text; _piece.Prix = prix; _piece.Stock = stock; - _piece.Fournisseur = FournisseurEntry.Text; +// _piece.Fournisseur = SelectedFournisseur; await Database.UpdatePieceAsync(_piece); await Navigation.PopAsync(); } diff --git a/MauiAppStock/Views/MainPage.xaml b/MauiAppStock/Views/MainPage.xaml index b18f554..9f05040 100644 --- a/MauiAppStock/Views/MainPage.xaml +++ b/MauiAppStock/Views/MainPage.xaml @@ -2,10 +2,7 @@ - -