Changement affichage
This commit is contained in:
parent
b8f9c55b66
commit
ee4626269e
@ -9,7 +9,7 @@ public partial class App : Application
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
// On démarre sur MainPage dans une NavigationPage pour permettre la navigation
|
// On démarre sur MainPage dans une NavigationPage pour permettre la navigation
|
||||||
MainPage = new NavigationPage(new MainPage());
|
MainPage = new AppShell();
|
||||||
InitializeDatabase();
|
InitializeDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,14 +3,15 @@
|
|||||||
x:Class="MauiAppStock.AppShell"
|
x:Class="MauiAppStock.AppShell"
|
||||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:local="clr-namespace:MauiAppStock"
|
|
||||||
xmlns:views="clr-namespace:MauiAppStock.Views"
|
xmlns:views="clr-namespace:MauiAppStock.Views"
|
||||||
Shell.FlyoutBehavior="Disabled"
|
Shell.FlyoutBehavior="Disabled"
|
||||||
Title="MauiAppStock">
|
Title="MauiAppStock">
|
||||||
|
|
||||||
<ShellContent
|
<Tab>
|
||||||
Title="Home"
|
<ShellContent Title="Acceuil" ContentTemplate="{DataTemplate views:MainPage}" />
|
||||||
ContentTemplate="{DataTemplate views:MainPage}"
|
<ShellContent Title="Appareils" ContentTemplate="{DataTemplate views:AppareilsPage}"/>
|
||||||
Route="MainPage" />
|
<ShellContent Title="Pièces" ContentTemplate="{DataTemplate views:PiecesPage}"/>
|
||||||
|
<ShellContent Title="Association" ContentTemplate="{DataTemplate views:SelectAppareilForAssociationPage}"/>
|
||||||
|
</Tab>
|
||||||
|
|
||||||
</Shell>
|
</Shell>
|
||||||
|
@ -1,9 +1,22 @@
|
|||||||
namespace MauiAppStock;
|
using MauiAppStock.Views;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
public partial class AppShell : Shell
|
public partial class AppShell : Shell
|
||||||
{
|
{
|
||||||
public AppShell()
|
public AppShell()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,9 @@
|
|||||||
<ListView x:Name="AssociationsListView" ItemsSource="{Binding AppareilPieces}"
|
<ListView x:Name="AssociationsListView" ItemsSource="{Binding AppareilPieces}"
|
||||||
IsPullToRefreshEnabled="True"
|
IsPullToRefreshEnabled="True"
|
||||||
RefreshCommand="{Binding LoadAssociationsCommand}"
|
RefreshCommand="{Binding LoadAssociationsCommand}"
|
||||||
ItemTapped="OnAssociationTapped">
|
ItemTapped="OnAssociationTapped"
|
||||||
|
HasUnevenRows="True"
|
||||||
|
HeightRequest="500">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
|
@ -25,7 +25,7 @@ namespace MauiAppStock.Views
|
|||||||
_piece.Description = DescriptionEditor.Text;
|
_piece.Description = DescriptionEditor.Text;
|
||||||
_piece.Prix = prix;
|
_piece.Prix = prix;
|
||||||
_piece.Stock = stock;
|
_piece.Stock = stock;
|
||||||
_piece.Fournisseur = FournisseurEntry.Text;
|
// _piece.Fournisseur = SelectedFournisseur;
|
||||||
await Database.UpdatePieceAsync(_piece);
|
await Database.UpdatePieceAsync(_piece);
|
||||||
await Navigation.PopAsync();
|
await Navigation.PopAsync();
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
<ContentPage x:Class="MauiAppStock.Views.MainPage"
|
<ContentPage x:Class="MauiAppStock.Views.MainPage"
|
||||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
<StackLayout Padding="20" Spacing="20" VerticalOptions="Center">
|
<VerticalStackLayout Padding="10" Spacing="10" >
|
||||||
<Label Text="Menu Principal" FontSize="30" HorizontalOptions="Center" />
|
<Label Text="Bienvenue sur le site : AppStock" FontSize="20"/>
|
||||||
<Button Text="Gestion des Appareils" Clicked="OnAppareilsClicked" />
|
</VerticalStackLayout>
|
||||||
<Button Text="Gestion des Pièces" Clicked="OnPiecesClicked" />
|
|
||||||
<Button Text="Associer une Pièce à un Appareil" Clicked="OnAssocierPieceClicked" />
|
|
||||||
</StackLayout>
|
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -3,6 +3,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
<StackLayout Padding="10">
|
<StackLayout Padding="10">
|
||||||
|
|
||||||
<Label Text="Sélectionnez un Appareil" FontSize="24" HorizontalOptions="Center" />
|
<Label Text="Sélectionnez un Appareil" FontSize="24" HorizontalOptions="Center" />
|
||||||
<ListView x:Name="AppareilsListView" ItemTapped="OnAppareilTapped">
|
<ListView x:Name="AppareilsListView" ItemTapped="OnAppareilTapped">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
|
@ -10,7 +10,11 @@ namespace MauiAppStock.Views
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LoadAppareils();
|
LoadAppareils();
|
||||||
}
|
}
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
LoadAppareils(); // Rafraîchit la liste à chaque affichage
|
||||||
|
}
|
||||||
private async void LoadAppareils()
|
private async void LoadAppareils()
|
||||||
{
|
{
|
||||||
var appareils = await Database.GetAppareilsAsync();
|
var appareils = await Database.GetAppareilsAsync();
|
||||||
@ -25,5 +29,7 @@ namespace MauiAppStock.Views
|
|||||||
await Navigation.PushAsync(new AppareilPiecesPage(selectedAppareil));
|
await Navigation.PushAsync(new AppareilPiecesPage(selectedAppareil));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user