diff --git a/Sources/Console/Program.cs b/Sources/Console/Program.cs
index 109716c..7620648 100644
--- a/Sources/Console/Program.cs
+++ b/Sources/Console/Program.cs
@@ -279,7 +279,7 @@ class Program
AfficherEntite(animal.Petsitter);
Console.WriteLine("\tCHENIL : ");
AfficherEntite(animal.Chenil);
- Console.WriteLine("\VETERINAIRE : ");
+ Console.WriteLine("\tVETERINAIRE : ");
AfficherEntite(animal.Veterinaire);
Console.WriteLine("\tMAGASIN ALIMENTAIRE : ");
AfficherEntite(animal.MagasinAlimentaire);
diff --git a/Sources/Model/Animal.cs b/Sources/Model/Animal.cs
index 2dfd43d..12d9e26 100644
--- a/Sources/Model/Animal.cs
+++ b/Sources/Model/Animal.cs
@@ -3,14 +3,19 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
+using System.Xml.Linq;
namespace Model
{
+ [DataContract(Name = "animal")]
public class Animal : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
+
+ [DataMember(Name = "nom")]
public string Nom
{
get => nom;
@@ -24,6 +29,8 @@ namespace Model
}
private string nom;
+
+ [DataMember(Name = "naissance")]
public string DateNaissance
{
get => dateNaissance;
@@ -37,6 +44,7 @@ namespace Model
}
private string dateNaissance;
+ [DataMember(Name = "sexe")]
public string Sexe
{
get => sexe;
@@ -49,6 +57,7 @@ namespace Model
}
private string sexe;
+ [DataMember(Name = "adoption")]
public string DateAdoption
{
get => dateAdoption;
@@ -62,6 +71,7 @@ namespace Model
}
private string dateAdoption;
+ [DataMember(Name = "taille")]
public float? Taille
{
get => taille;
@@ -75,6 +85,7 @@ namespace Model
}
private float? taille;
+ [DataMember(Name = "poids")]
public float? Poids
{
get => poids;
@@ -88,6 +99,7 @@ namespace Model
}
private float? poids;
+ [DataMember(Name = "alimentation")]
public string Alimentation
{
get => alimentation;
@@ -101,6 +113,7 @@ namespace Model
}
private string alimentation;
+ [DataMember(Name = "espèce")]
public Espece? Espece
{
get => espece;
@@ -114,6 +127,7 @@ namespace Model
}
private Espece? espece;
+ [DataMember(Name = "race")]
public Race? Race
{
get => race;
@@ -127,6 +141,7 @@ namespace Model
}
private Race? race;
+ [DataMember(Name = "veterinaire")]
public Veterinaire? Veterinaire
{
get => veterinaire;
@@ -140,6 +155,7 @@ namespace Model
}
private Veterinaire? veterinaire = new Veterinaire();
+ [DataMember(Name = "chenil")]
public Chenil? Chenil
{
get => chenil;
@@ -153,6 +169,7 @@ namespace Model
}
private Chenil? chenil = new Chenil();
+ [DataMember(Name = "magasinAlimentaire")]
public MagasinAlimentaire? MagasinAlimentaire
{
get => magasinAlimentaire;
@@ -166,6 +183,7 @@ namespace Model
}
private MagasinAlimentaire? magasinAlimentaire = new MagasinAlimentaire();
+ [DataMember(Name = "provenance")]
public Provenance? Provenance
{
get => provenance;
@@ -179,6 +197,7 @@ namespace Model
}
private Provenance? provenance = new Provenance();
+ [DataMember(Name = "petsitter")]
public Petsitter? Petsitter
{
get => petsitter;
@@ -192,6 +211,20 @@ namespace Model
}
private Petsitter? petsitter = new Petsitter();
+ [DataMember(Name = "image")]
+ public string Image
+ {
+ get => image;
+ set
+ {
+ if (image == value)
+ return;
+ image = value;
+ OnPropertyChanged(nameof(Image));
+ }
+ }
+ private string image;
+
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;
diff --git a/Sources/Model/Chenil.cs b/Sources/Model/Chenil.cs
index 175ace1..3c666b4 100644
--- a/Sources/Model/Chenil.cs
+++ b/Sources/Model/Chenil.cs
@@ -8,11 +8,5 @@ namespace Model
{
public class Chenil : Entite
{
- public Entite Entite { get; set; }
-
- public Chenil()
- {
- Entite = new Entite();
- }
}
}
diff --git a/Sources/Model/Entite.cs b/Sources/Model/Entite.cs
index fc4c663..e82e384 100644
--- a/Sources/Model/Entite.cs
+++ b/Sources/Model/Entite.cs
@@ -87,7 +87,7 @@ namespace Model
NumTel = numTel;
}
- void OnPropertyChanged(string propertyName)
+ public void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
diff --git a/Sources/Model/MagasinAlimentaire.cs b/Sources/Model/MagasinAlimentaire.cs
index d808f77..ca0ae05 100644
--- a/Sources/Model/MagasinAlimentaire.cs
+++ b/Sources/Model/MagasinAlimentaire.cs
@@ -8,11 +8,5 @@ namespace Model
{
public class MagasinAlimentaire : Entite
{
- public Entite Entite { get; set; }
-
- public MagasinAlimentaire()
- {
- Entite = new Entite();
- }
}
}
diff --git a/Sources/Model/Petsitter.cs b/Sources/Model/Petsitter.cs
index 96d6630..3540bba 100644
--- a/Sources/Model/Petsitter.cs
+++ b/Sources/Model/Petsitter.cs
@@ -9,11 +9,5 @@ namespace Model
{
public class Petsitter : Entite
{
- public Entite Entite { get; set; }
-
- public Petsitter()
- {
- Entite = new Entite();
- }
}
}
diff --git a/Sources/Model/Provenance.cs b/Sources/Model/Provenance.cs
index aefce2f..339d9cd 100644
--- a/Sources/Model/Provenance.cs
+++ b/Sources/Model/Provenance.cs
@@ -8,11 +8,5 @@ namespace Model
{
public class Provenance : Entite
{
- public Entite Entite { get; set; }
-
- public Provenance()
- {
- Entite = new Entite();
- }
}
}
diff --git a/Sources/Model/Race.cs b/Sources/Model/Race.cs
index d456481..aef0233 100644
--- a/Sources/Model/Race.cs
+++ b/Sources/Model/Race.cs
@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
+using System.Xml.Linq;
namespace Model
{
@@ -20,6 +22,8 @@ namespace Model
public string Cout { get; }
public string Conseil { get; }
+ public string Image { get; }
+
public Race(string nom = "Inconnu", string nomScientifique = "Inconnu", string esperanceVie = "Inconnue", string poidsMoyen = "Inconnu", string tailleMoyenne = "Inconnu", string comportement = "Auncune information", string sante = "Aucune information", string education = "Auncune information", string entretien = "Aucune information", string cout = "Auncune information", string conseil = "Aucun conseil")
{
Nom = nom;
diff --git a/Sources/Model/Veterinaire.cs b/Sources/Model/Veterinaire.cs
index 96d8454..637e8e4 100644
--- a/Sources/Model/Veterinaire.cs
+++ b/Sources/Model/Veterinaire.cs
@@ -9,7 +9,6 @@ namespace Model
{
public class Veterinaire : Entite
{
- public Entite Entite { get; set; }
public string Clinique
{
get => clinique;
@@ -18,14 +17,9 @@ namespace Model
if(clinique == value)
return;
clinique = value;
- Entite.OnPropertyChanged(nameof(Clinique));
+ OnPropertyChanged(nameof(Clinique));
}
}
private string clinique;
-
- public Veterinaire()
- {
- Entite = new Entite();
- }
}
}
diff --git a/Sources/Views/DetailAnimal.xaml b/Sources/Views/DetailAnimal.xaml
index d1e4624..5f2be63 100644
--- a/Sources/Views/DetailAnimal.xaml
+++ b/Sources/Views/DetailAnimal.xaml
@@ -15,6 +15,12 @@
MaximumWidthRequest="300"
Margin="20"
HorizontalOptions="Center"/>
+
-
@@ -220,31 +226,38 @@
Text="{Binding Veterinaire.Entite.Nom}"/>
+ Text="Clinique"/>
+ Text="{Binding Veterinaire.Clinique}"/>
+ Text="Adresse"/>
+ Text="{Binding Veterinaire.Entite.Adresse}"/>
+ Text="Code postal"/>
+ Text="{Binding Veterinaire.Entite.CodePostal}"/>
+ Text="Ville"/>
+
+
diff --git a/Sources/Views/DetailAnimal.xaml.cs b/Sources/Views/DetailAnimal.xaml.cs
index 84ea90d..f3af527 100644
--- a/Sources/Views/DetailAnimal.xaml.cs
+++ b/Sources/Views/DetailAnimal.xaml.cs
@@ -27,4 +27,25 @@ public partial class DetailAnimal : ContentPage
{
(App.Current as App).AnimalSelectionner.Race = (sender as Picker).SelectedItem as Race;
}
+
+ public async void TakePhoto(object sender, EventArgs e)
+ {
+ if (MediaPicker.Default.IsCaptureSupported)
+ {
+ FileResult photo = await MediaPicker.Default.PickPhotoAsync();
+
+ if (photo != null)
+ {
+ // save the file into local storage
+ string localFilePath = Path.Combine(FileSystem.AppDataDirectory, photo.FileName);
+
+ using Stream sourceStream = await photo.OpenReadAsync();
+ using FileStream localFileStream = File.OpenWrite(localFilePath);
+
+ await sourceStream.CopyToAsync(localFileStream);
+
+ (App.Current as App).AnimalSelectionner.Image = Path.Combine(FileSystem.AppDataDirectory, photo.FileName);
+ }
+ }
+ }
}
\ No newline at end of file