diff --git a/Solution/Wikipet's/Console/Program.cs b/Solution/Wikipet's/Console/Program.cs index af0efdf..cc37372 100644 --- a/Solution/Wikipet's/Console/Program.cs +++ b/Solution/Wikipet's/Console/Program.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; namespace MyProject; class Program { - public static Especetheque Especetheque { get; } = Stub.LaodEspecetheque(); + public static Especetheque Especetheque { get; } = new Especetheque(); public static Zootheque Zootheque { get; set; } = new Zootheque(); static void Main(string[] args) diff --git a/Solution/Wikipet's/Model/Espece.cs b/Solution/Wikipet's/Model/Espece.cs index ea307fc..b8fb84b 100644 --- a/Solution/Wikipet's/Model/Espece.cs +++ b/Solution/Wikipet's/Model/Espece.cs @@ -12,6 +12,7 @@ namespace Model { public string Nom { get; } public string NomScientifique { get; } + public string Image { get; } public string EsperanceVie { get; } public string PoidsMoyen { get; } public string TailleMoyenne { get; } @@ -24,10 +25,11 @@ namespace Model public string Conseil { get; } - public Espece(string nom = "", string nomScientifique = "", string esperanceVie = "", string poidsMoyen = "", string tailleMoyenne = "", HashSet? races = null, string comportement = "", string sante = "", string education = "", string entretien = "", string cout = "", string conseil = "") + public Espece(string nom = "", string nomScientifique = "", string image = "", string esperanceVie = "", string poidsMoyen = "", string tailleMoyenne = "", HashSet? races = null, string comportement = "", string sante = "", string education = "", string entretien = "", string cout = "", string conseil = "") { Nom = nom; NomScientifique = nomScientifique; + Image = image; EsperanceVie = esperanceVie; PoidsMoyen = poidsMoyen; TailleMoyenne = tailleMoyenne; diff --git a/Solution/Wikipet's/Model/Especetheque.cs b/Solution/Wikipet's/Model/Especetheque.cs index fc51d35..d69cf75 100644 --- a/Solution/Wikipet's/Model/Especetheque.cs +++ b/Solution/Wikipet's/Model/Especetheque.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using System.Text; @@ -9,11 +10,25 @@ namespace Model { public class Especetheque { - public HashSet ListeEspeces = new HashSet(); + public ReadOnlyCollection ListeEspeces { get; private set; } + private readonly List listeEspeces = new List(); - public Especetheque(HashSet listeEspece) + public Especetheque() { - ListeEspeces = listeEspece; + ListeEspeces = new ReadOnlyCollection(listeEspeces); + LoadEspecetheque(); + } + + private void LoadEspecetheque() + { + HashSet Races = new HashSet(); + Races.Add(new("Abyssin")); + Races.Add(new("American curl")); + + listeEspeces.Add(new("Chien", "Canis lupus familiaris", "chien.png")); + listeEspeces.Add(new("Chat", "Felis catus", "chat.png", "15 à 20 ans", "15 à 20 kg", "10 à 15 cm", Races)); + listeEspeces.Add(new("Hamster", "Cricetinae")); + listeEspeces.Add(new("Lapin", "Oryctolagus cuniculus")); } public void AfficherListeEspece() diff --git a/Solution/Wikipet's/Model/Stub.cs b/Solution/Wikipet's/Model/Stub.cs index 59c9e04..f352f9f 100644 --- a/Solution/Wikipet's/Model/Stub.cs +++ b/Solution/Wikipet's/Model/Stub.cs @@ -8,20 +8,6 @@ namespace Model { public class Stub { - public static Especetheque LaodEspecetheque() - { - HashSet Races = new HashSet(); - Races.Add(new("Abyssin")); - Races.Add(new("American curl")); - - HashSet ListeEspeces = new HashSet(); - ListeEspeces.Add(new("Chien", "Canis lupus familiaris")); - ListeEspeces.Add(new("Chat", "Felis catus", "15 à 20 ans", "15 à 20 kg", "10 à 15 cm", Races)); - ListeEspeces.Add(new("Hamster", "Cricetinae")); - ListeEspeces.Add(new("Lapin", "Oryctolagus cuniculus")); - - - return (new(ListeEspeces)); - } + } } diff --git a/Solution/Wikipet's/Model/Zootheque.cs b/Solution/Wikipet's/Model/Zootheque.cs index 9b370fd..dd2c36c 100644 --- a/Solution/Wikipet's/Model/Zootheque.cs +++ b/Solution/Wikipet's/Model/Zootheque.cs @@ -6,8 +6,8 @@ using System.Threading.Tasks; namespace Model { - public class Zootheque - { + public class Zootheque { + public HashSet ListeAnimaux = new HashSet(); public Zootheque() diff --git a/Solution/Wikipet's/Views/AppShell.xaml b/Solution/Wikipet's/Views/AppShell.xaml index dba497b..02dfe83 100644 --- a/Solution/Wikipet's/Views/AppShell.xaml +++ b/Solution/Wikipet's/Views/AppShell.xaml @@ -4,7 +4,7 @@ xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Views" - Shell.FlyoutBehavior="Disabled"> + Shell.FlyoutBehavior="Flyout"> - diff --git a/Solution/Wikipet's/Views/Especes.xaml b/Solution/Wikipet's/Views/Especes.xaml index 369b086..bfcc306 100644 --- a/Solution/Wikipet's/Views/Especes.xaml +++ b/Solution/Wikipet's/Views/Especes.xaml @@ -3,10 +3,41 @@ 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 3ef2dd5..a3f9bf2 100644 --- a/Solution/Wikipet's/Views/Especes.xaml.cs +++ b/Solution/Wikipet's/Views/Especes.xaml.cs @@ -1,9 +1,14 @@ +using System.Diagnostics; +using Model; + namespace Views; public partial class Especes : ContentPage { - public Especes() + public Especetheque Especetheque { get; private set; } = new Especetheque(); + public Especes() { InitializeComponent(); + BindingContext = Especetheque; } } \ No newline at end of file diff --git a/Solution/Wikipet's/Views/MainPage.xaml b/Solution/Wikipet's/Views/MainPage.xaml index e04fc2f..f957745 100644 --- a/Solution/Wikipet's/Views/MainPage.xaml +++ b/Solution/Wikipet's/Views/MainPage.xaml @@ -1,34 +1,6 @@  - - - - - - - - - + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + x:Class="Views.MainPage"> + diff --git a/Solution/Wikipet's/Views/MainPage.xaml.cs b/Solution/Wikipet's/Views/MainPage.xaml.cs index 1bbec15..20271cd 100644 --- a/Solution/Wikipet's/Views/MainPage.xaml.cs +++ b/Solution/Wikipet's/Views/MainPage.xaml.cs @@ -1,8 +1,10 @@ -namespace Views +using Model; + +namespace Views { public partial class MainPage : ContentPage { - int count = 0; + public MainPage() { diff --git a/Solution/Wikipet's/Views/Resources/Images/chat.jpg b/Solution/Wikipet's/Views/Resources/Images/chat.jpg new file mode 100644 index 0000000..522e4aa Binary files /dev/null and b/Solution/Wikipet's/Views/Resources/Images/chat.jpg differ diff --git a/Solution/Wikipet's/Views/Resources/Images/chien.jpg b/Solution/Wikipet's/Views/Resources/Images/chien.jpg new file mode 100644 index 0000000..4e57b32 Binary files /dev/null and b/Solution/Wikipet's/Views/Resources/Images/chien.jpg differ diff --git a/Solution/Wikipet's/Views/Resources/Styles/Colors.xaml b/Solution/Wikipet's/Views/Resources/Styles/Colors.xaml index d183ec4..f7a8cbd 100644 --- a/Solution/Wikipet's/Views/Resources/Styles/Colors.xaml +++ b/Solution/Wikipet's/Views/Resources/Styles/Colors.xaml @@ -4,8 +4,8 @@ xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> - #512BD4 - #DFD8F7 + #ff9d5e + #402e32 #2B0B98 White Black diff --git a/Solution/Wikipet's/Views/Views.csproj b/Solution/Wikipet's/Views/Views.csproj index ebf6bb5..34242af 100644 --- a/Solution/Wikipet's/Views/Views.csproj +++ b/Solution/Wikipet's/Views/Views.csproj @@ -52,6 +52,10 @@ + + + + Especes.xaml @@ -59,6 +63,9 @@ + + MSBuild:Compile + MSBuild:Compile diff --git a/Solution/Wikipet's/Wikipet's.sln b/Solution/Wikipet's/Wikipet's.sln index 48c95fa..4432748 100644 --- a/Solution/Wikipet's/Wikipet's.sln +++ b/Solution/Wikipet's/Wikipet's.sln @@ -7,7 +7,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console", "Console\Console. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{83309215-075B-406F-A72E-45E40AD47E43}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Views", "Views\Views.csproj", "{6FB34AC9-C9A0-4223-96A0-C8D3D7C3242F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Views", "Views\Views.csproj", "{6FB34AC9-C9A0-4223-96A0-C8D3D7C3242F}" + ProjectSection(ProjectDependencies) = postProject + {83309215-075B-406F-A72E-45E40AD47E43} = {83309215-075B-406F-A72E-45E40AD47E43} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution