From 445e5b5cab4812fd8c3b7e0968aef4eb2e79721c Mon Sep 17 00:00:00 2001 From: Leana BESSON Date: Tue, 23 May 2023 15:29:29 +0200 Subject: [PATCH] Changement page --- Solution/Wikipet's/Views/Animaux.xaml | 45 +++++++++++++++++ Solution/Wikipet's/Views/Animaux.xaml.cs | 13 +++++ Solution/Wikipet's/Views/App.xaml.cs | 14 +++++- Solution/Wikipet's/Views/AppShell.xaml | 9 ++++ Solution/Wikipet's/Views/DetailEspece.xaml | 11 +++++ Solution/Wikipet's/Views/DetailEspece.xaml.cs | 23 +++++++++ Solution/Wikipet's/Views/Especes.xaml | 49 +++++++++++-------- Solution/Wikipet's/Views/Especes.xaml.cs | 14 ++++-- Solution/Wikipet's/Views/Views.csproj | 9 ++++ 9 files changed, 161 insertions(+), 26 deletions(-) create mode 100644 Solution/Wikipet's/Views/Animaux.xaml create mode 100644 Solution/Wikipet's/Views/Animaux.xaml.cs create mode 100644 Solution/Wikipet's/Views/DetailEspece.xaml create mode 100644 Solution/Wikipet's/Views/DetailEspece.xaml.cs diff --git a/Solution/Wikipet's/Views/Animaux.xaml b/Solution/Wikipet's/Views/Animaux.xaml new file mode 100644 index 0000000..b17c1bb --- /dev/null +++ b/Solution/Wikipet's/Views/Animaux.xaml @@ -0,0 +1,45 @@ + + + + + \ No newline at end of file diff --git a/Solution/Wikipet's/Views/Animaux.xaml.cs b/Solution/Wikipet's/Views/Animaux.xaml.cs new file mode 100644 index 0000000..7197165 --- /dev/null +++ b/Solution/Wikipet's/Views/Animaux.xaml.cs @@ -0,0 +1,13 @@ +using Model; + +namespace Views; + +public partial class Animaux : ContentPage +{ + public Zootheque Zootheque { get; set; } = new Zootheque(); + public Animaux() + { + InitializeComponent(); + BindingContext = Zootheque; + } +} \ No newline at end of file diff --git a/Solution/Wikipet's/Views/App.xaml.cs b/Solution/Wikipet's/Views/App.xaml.cs index 2d3448a..488973f 100644 --- a/Solution/Wikipet's/Views/App.xaml.cs +++ b/Solution/Wikipet's/Views/App.xaml.cs @@ -1,12 +1,24 @@ -namespace Views +using Model; + +namespace Views { public partial class App : Application { + public Especetheque Especetheque { get; private set; } = new Especetheque(); + public Espece EspeceSelectionner { + get => EspeceSelectionner; + set + { + EspeceSelectionner = value; + OnPropertyChanged(nameof(EspeceSelectionner)); + } + } public App() { InitializeComponent(); MainPage = new AppShell(); + BindingContext = Especetheque; } } } \ No newline at end of file diff --git a/Solution/Wikipet's/Views/AppShell.xaml b/Solution/Wikipet's/Views/AppShell.xaml index 02dfe83..0e912d3 100644 --- a/Solution/Wikipet's/Views/AppShell.xaml +++ b/Solution/Wikipet's/Views/AppShell.xaml @@ -15,4 +15,13 @@ Title="Les espèces" ContentTemplate="{DataTemplate local:Especes}" Route="Especes" /> + + + + diff --git a/Solution/Wikipet's/Views/DetailEspece.xaml b/Solution/Wikipet's/Views/DetailEspece.xaml new file mode 100644 index 0000000..cfee7d0 --- /dev/null +++ b/Solution/Wikipet's/Views/DetailEspece.xaml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/Solution/Wikipet's/Views/DetailEspece.xaml.cs b/Solution/Wikipet's/Views/DetailEspece.xaml.cs new file mode 100644 index 0000000..a234034 --- /dev/null +++ b/Solution/Wikipet's/Views/DetailEspece.xaml.cs @@ -0,0 +1,23 @@ +using Model; + +namespace Views; + +public partial class DetailEspece : ContentPage +{ + Especes espece; + public Especes Espece + { + get => espece; + set + { + espece = value; + OnPropertyChanged(); + } + + } + public DetailEspece() + { + InitializeComponent(); + BindingContext = (App.Current as App).EspeceSelectionner; + } +} \ No newline at end of file diff --git a/Solution/Wikipet's/Views/Especes.xaml b/Solution/Wikipet's/Views/Especes.xaml index bfcc306..81ec872 100644 --- a/Solution/Wikipet's/Views/Especes.xaml +++ b/Solution/Wikipet's/Views/Especes.xaml @@ -3,41 +3,48 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Views.Especes" Title="Especes"> - - + - - + + \ No newline at end of file diff --git a/Solution/Wikipet's/Views/Especes.xaml.cs b/Solution/Wikipet's/Views/Especes.xaml.cs index a3f9bf2..4d76cab 100644 --- a/Solution/Wikipet's/Views/Especes.xaml.cs +++ b/Solution/Wikipet's/Views/Especes.xaml.cs @@ -5,10 +5,16 @@ namespace Views; public partial class Especes : ContentPage { - public Especetheque Especetheque { get; private set; } = new Especetheque(); + public Especes() { - InitializeComponent(); - BindingContext = Especetheque; + InitializeComponent(); + BindingContext = (App.Current as App).Especetheque; } -} \ No newline at end of file + + public async void OnClick(object sender, SelectedItemChangedEventArgs e) + { + (App.Current as App).EspeceSelectionner = e.SelectedItem as Espece; + await Shell.Current.GoToAsync("//DetailEspece"); + } +} diff --git a/Solution/Wikipet's/Views/Views.csproj b/Solution/Wikipet's/Views/Views.csproj index 34242af..3a27fb6 100644 --- a/Solution/Wikipet's/Views/Views.csproj +++ b/Solution/Wikipet's/Views/Views.csproj @@ -60,15 +60,24 @@ Especes.xaml + + Animaux.xaml + + + MSBuild:Compile + MSBuild:Compile MSBuild:Compile + + MSBuild:Compile +