diff --git a/Sources/Model/Animal.cs b/Sources/Model/Animal.cs
index 6463463..c60dbde 100644
--- a/Sources/Model/Animal.cs
+++ b/Sources/Model/Animal.cs
@@ -18,7 +18,7 @@ namespace Model
public Espece Espece { get; set; }
public Race? Race { get; set; }
- public Animal(string nom, string dateNaissance = "", string sexe = "", string dateAdpotion = "", float? taille = null, float? poids = null, string alimentation = "", Race? race = null)
+ public Animal(string nom, string dateNaissance = "Inconnue", string sexe = "Inconnu", string dateAdpotion = "Inconnue", float? taille = null, float? poids = null, string alimentation = "Inconnue", Race? race = null)
{
Nom = nom;
DateNaissance = dateNaissance;
diff --git a/Sources/Model/Stub.cs b/Sources/Model/Stub.cs
index dfb5cca..8dda9fd 100644
--- a/Sources/Model/Stub.cs
+++ b/Sources/Model/Stub.cs
@@ -29,6 +29,10 @@ namespace Model
listeAnimaux.Add(new("Kiki"));
listeAnimaux.Add(new("PouetPouet"));
+ listeAnimaux.Add(new("Chouchou"));
+ listeAnimaux.Add(new("Pupuce"));
+ listeAnimaux.Add(new("AucuneIdée"));
+ listeAnimaux.Add(new("Minou"));
return listeAnimaux;
}
diff --git a/Sources/Views/Animaux.xaml b/Sources/Views/Animaux.xaml
index e87dff2..e09adeb 100644
--- a/Sources/Views/Animaux.xaml
+++ b/Sources/Views/Animaux.xaml
@@ -1,51 +1,58 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/Views/Animaux.xaml.cs b/Sources/Views/Animaux.xaml.cs
index 0e870dc..6ed7292 100644
--- a/Sources/Views/Animaux.xaml.cs
+++ b/Sources/Views/Animaux.xaml.cs
@@ -1,3 +1,4 @@
+using CommunityToolkit.Maui.Layouts;
using Model;
namespace Views;
@@ -10,4 +11,11 @@ public partial class Animaux : ContentPage
InitializeComponent();
BindingContext = (App.Current as App).Theque.Zootheque;
}
-}
\ No newline at end of file
+
+ public void OnClick(object sender, ItemTappedEventArgs e)
+ {
+ (App.Current as App).AnimalSelectionner = e.Item as Animal;
+ Navigation.PushAsync(new DetailAnimal());
+ }
+}
+
diff --git a/Sources/Views/App.xaml.cs b/Sources/Views/App.xaml.cs
index 7f7747a..91e6812 100644
--- a/Sources/Views/App.xaml.cs
+++ b/Sources/Views/App.xaml.cs
@@ -7,16 +7,14 @@ namespace Views
public partial class App : Application, INotifyPropertyChanged
{
public Theque Theque { get; set; } = new Theque();
- public Animal AnimalSelectionner;
- public Espece EspeceSelectionner;
- public Race RaceSelectionner;
+ public Animal AnimalSelectionner { get; set; }
+ public Espece EspeceSelectionner { get; set; }
+ public Race RaceSelectionner { get; set; }
public App()
{
InitializeComponent();
-
MainPage = new AppShell();
-
}
}
}
\ No newline at end of file
diff --git a/Sources/Views/DetailAnimal.xaml b/Sources/Views/DetailAnimal.xaml
new file mode 100644
index 0000000..76fc48c
--- /dev/null
+++ b/Sources/Views/DetailAnimal.xaml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/Views/DetailAnimal.xaml.cs b/Sources/Views/DetailAnimal.xaml.cs
new file mode 100644
index 0000000..1d12848
--- /dev/null
+++ b/Sources/Views/DetailAnimal.xaml.cs
@@ -0,0 +1,10 @@
+namespace Views;
+
+public partial class DetailAnimal : ContentPage
+{
+ public DetailAnimal()
+ {
+ InitializeComponent();
+ BindingContext = (App.Current as App).AnimalSelectionner;
+ }
+}
\ No newline at end of file
diff --git a/Sources/Views/DetailEspece.xaml b/Sources/Views/DetailEspece.xaml
index bd801c3..90a2d30 100644
--- a/Sources/Views/DetailEspece.xaml
+++ b/Sources/Views/DetailEspece.xaml
@@ -125,7 +125,7 @@ FontSize="Large"/>
FontSize="Large"/>
+ ItemTapped="OnClick">
diff --git a/Sources/Views/DetailEspece.xaml.cs b/Sources/Views/DetailEspece.xaml.cs
index b1326ba..5cfc59a 100644
--- a/Sources/Views/DetailEspece.xaml.cs
+++ b/Sources/Views/DetailEspece.xaml.cs
@@ -11,9 +11,9 @@ public partial class DetailEspece : ContentPage
BindingContext = (App.Current as App).EspeceSelectionner;
}
- public async void OnClick(object sender, SelectedItemChangedEventArgs e)
+ public async void OnClick(object sender, ItemTappedEventArgs e)
{
- (App.Current as App).RaceSelectionner = e.SelectedItem as Race;
+ (App.Current as App).RaceSelectionner = e.Item as Race;
await Navigation.PushAsync(new DetailRace());
}
}
\ No newline at end of file
diff --git a/Sources/Views/DetailRace.xaml b/Sources/Views/DetailRace.xaml
index 2564587..52c27a5 100644
--- a/Sources/Views/DetailRace.xaml
+++ b/Sources/Views/DetailRace.xaml
@@ -3,106 +3,119 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Views.DetailRace"
Title="{Binding Nom}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sources/Views/Especes.xaml b/Sources/Views/Especes.xaml
index ae8c97f..798f850 100644
--- a/Sources/Views/Especes.xaml
+++ b/Sources/Views/Especes.xaml
@@ -8,7 +8,7 @@
Padding="20">
+ ItemTapped="OnClick">
diff --git a/Sources/Views/Especes.xaml.cs b/Sources/Views/Especes.xaml.cs
index 9ac330f..1cc9d1a 100644
--- a/Sources/Views/Especes.xaml.cs
+++ b/Sources/Views/Especes.xaml.cs
@@ -12,9 +12,9 @@ public partial class Especes : ContentPage
BindingContext = (App.Current as App).Theque.Especetheque;
}
- public void OnClick(object sender, SelectedItemChangedEventArgs e)
+ public void OnClick(object sender, ItemTappedEventArgs e)
{
- (App.Current as App).EspeceSelectionner = e.SelectedItem as Espece;
+ (App.Current as App).EspeceSelectionner = e.Item as Espece;
Navigation.PushAsync(new DetailEspece());
}
}
diff --git a/Sources/Views/MainPage.xaml b/Sources/Views/MainPage.xaml
index 696c48f..23452b4 100644
--- a/Sources/Views/MainPage.xaml
+++ b/Sources/Views/MainPage.xaml
@@ -1,6 +1,8 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
+ xmlns:local="clr-namespace:Views"
+ x:Class="Views.MainPage">
+
diff --git a/Sources/Views/MauiProgram.cs b/Sources/Views/MauiProgram.cs
index 21b9066..2848e70 100644
--- a/Sources/Views/MauiProgram.cs
+++ b/Sources/Views/MauiProgram.cs
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
+using CommunityToolkit.Maui;
namespace Views
{
@@ -9,6 +10,7 @@ namespace Views
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
+ .UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
diff --git a/Sources/Views/Views.csproj b/Sources/Views/Views.csproj
index a99c7d1..605d914 100644
--- a/Sources/Views/Views.csproj
+++ b/Sources/Views/Views.csproj
@@ -49,6 +49,7 @@
+
@@ -66,6 +67,9 @@
+
+ MSBuild:Compile
+
MSBuild:Compile