Résolution conflits Master - devYoan

pull/15/head
Yoan BRUGIÈRE 2 years ago
commit 4829355327

@ -158,6 +158,105 @@ Class StubPersonnage {
}
<<<<<<< HEAD
=======
class Serializer {
+ SetPersonnage(listePerso : List~Personnage~) : void
+ SetFDD(listeFDD : List~FruitDuDemon~) : void
+ SetBestiaire(listeBest : List~Bestiaire~) : void
+ SetEquipage(listeEquip : List~Equipage~) : void
+ SetIle(listeIle : List~Ile~) : void
+ SetBateau(listeBateau : List~Bateau~) : void
+ GetBateaux() : IEnumerable~Bateau~
+ GetBestiaires() : IEnumerable~Bestiaire~
+ GetEquipages() : IEnumerable~Equipage~
+ GetFruits() : IEnumerable~FruitDuDemon~
+ GetIles() : IEnumerable~Ile~
+ GetPersonnages() : IEnumerable~Personnage~
}
class Manager {
+ DataManager : IDataManager
+ Bateaux : ObservableCollection~Bateau~
+ Manager()
+ GetPersonnages() : List~Personnage~
+ GetFruits() : List~FruitDuDemon~
+ GetEquipages() : List~Equipage~
+ GetBateaux() : List~Bateau~
+ GetBestiaires() : List~Bestiaire~
+ GetIles() : List~Ile~
+ FiltrerFDD(type : string) : List~FruitDuDemon~
+ RechercheFDD(text : string, listeFDD : List~FruitDuDemon~) : List~FruitDuDemon~
+ RechercheObjetOhara(text : string, liste List~ObjetOhara~) : List~ObjetOhara~
+ GetFavoris() : List~ObjetOhara~
+ AddBateauFavoris(bateau : Bateau) : void
}
class IDataManager {
<<interface>>
GetBateaux() : IEnumerable~Bateau~
GetBestiaires() : IEnumerable~Bestiaire~
GetEquipages() : IEnumerable~Equipage~
GetFruits() : IEnumerable~FruitDuDemon~
GetIles() : IEnumerable~Ile~
GetPersonnages() : IEnumerable~Personnage~
}
class StubManager {
+ StubPersonnage : StubPersonnage
+ StubFruitDuDemon : StubFruitDuDemon
+ StubEquipage : StubEquipage
+ StubBateau : StubBateau
+ StubBestiaire : StubBestiaire
+ StubIle : StubIle
+ StubManager()
+ GetPersonnages() : IEnumerable~Personnage~
+ GetFruits() : IEnumerable~FruitDuDemon~
+ GetEquipages() : IEnumerable~Equipage~
+ GetBateaux() : IEnumerable~Bateau~
+ GetBestiaires() : IEnumerable~Bestiaire~
+ GetIles() : IEnumerable~Ile~
}
class StubBateau {
+ RecupererBateau : IEnumerable~Bateau~
}
class StubBestiaire {
+ RecupererBestiaire : IEnumerable~Bestiaire~
}
class StubEquipage {
+ RecupererEquipage : IEnumerable~Equipage~
}
class StubFruitDuDemon {
+ RecupererFruit : IEnumerable~FruitDuDemon~
}
class StubIle {
+ RecupererIle : IEnumerable~Ile~
}
class StubPersonnage {
+ RecupererPersonnage : IEnumerable~Personnage~
}
FruitDuDemon --> Personnage : + Utilisateur
Personnage --> Equipage : + Equipage
Personnage --> FruitDuDemon : + Fruit
Bateau --> Equipage : + Affiliation
Equipage --> Personnage : + Capitaine
Equipage --> Personnage : + Membre
Equipage --> Equipage : + Allie
>>>>>>> devYoan
FruitDuDemon --> "+ Utilisateur" Personnage
Personnage --> "+ Equipage" Equipage

@ -59,5 +59,32 @@ namespace Model.Classes
{
Affiliation = affiliation;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
Bateau o = (Bateau)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(NomRomanise, Affiliation, PremierChap, PremierEp, Description, Caracteristique);
}
public override string ToString()
{
return "Bateau :" + Nom +" "+EstFavori +" " + NomRomanise + " " + Affiliation + " " + PremierChap + " " + PremierEp + " " + Description + " " + Caracteristique +" "+ Image;
}
}
}

@ -19,8 +19,6 @@ namespace Model.Classes
[DataMember(Name = "caracteristique")]
public string Caracteristique { get; set; }
public Bestiaire(string nom, string origine, string description, string caracteristique) : base(nom)
{
Origine = origine;
@ -32,7 +30,30 @@ namespace Model.Classes
{
Image = image;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
Bestiaire o = (Bestiaire)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(Origine, Description, Caracteristique);
}
public override string ToString()
{
return "Bestiaire :" + Nom +" "+EstFavori+ " " + Origine + " " + Description + " " + Caracteristique +" " + Image;
}
}
}

@ -64,6 +64,30 @@ namespace Model.Classes
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
Equipage o = (Equipage)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(NomRomanise, Region, PremierChap, PremierEp, Statut, Description);
}
public override string ToString()
{
return "Equipage :" + Nom +" "+EstFavori+ " " + NomRomanise + " " + Region + " " + PremierChap + " " + PremierEp + " " + Statut + " " + Description + " " + Image;
}
}
}

@ -66,5 +66,30 @@ namespace Model.Classes
{
Utilisateur = utilisateur;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
FruitDuDemon o = (FruitDuDemon)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(NomRomanise, Type, PremierChap, PremierEp, Description, Forces, Faiblesses);
}
public override string ToString()
{
return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image;
}
}
}

@ -57,5 +57,27 @@ namespace Model.Classes
Image = image;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
else
{
Ile o = (Ile)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(NomRomanise, Region, PremierChap, PremierEp, Description, Geographie);
}
public override string ToString()
{
return "Ile :"+ Nom +" "+NomRomanise+" "+Region+" "+PremierChap+" "+PremierEp+" "+Description+" "+Geographie+" "+Image;
}
}
}

@ -12,9 +12,11 @@ namespace Model.Classes
{
[DataMember(Name = "nom")]
public string Nom { get; set; }
[DataMember(Name = "image")]
public string? Image { get; set; }
[DataMember(Name = "estfavori")]
public bool EstFavori { get; set; }
public ObjetOhara(string nom, string image = "baseimage.png", bool estFavori = false)
@ -23,6 +25,31 @@ namespace Model.Classes
Image = image;
EstFavori = estFavori;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
ObjetOhara o = (ObjetOhara)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(Nom, Image,EstFavori);
}
public override string ToString()
{
return "ObjetOhara :" + Nom + " " +EstFavori+ " " + Image;
}
}
}

@ -65,5 +65,31 @@ namespace Model.Classes
Fruit = fruit;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
Personnage o = (Personnage)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(Prime, Epithete, Age, Origine,Biographie, Citation,Equipage,Fruit);
}
public override string ToString()
{
return "Personnage :" + Nom + " " + EstFavori + " " + Prime + " " + Epithete + " " + Age + " " + Origine + " " + Biographie + " "+ Citation+" " +Equipage+" " + Fruit+" "+ Image;
}
}
}

@ -15,5 +15,11 @@ namespace Model.Managers
IEnumerable<FruitDuDemon> GetFruits();
IEnumerable<Ile> GetIles();
IEnumerable<Personnage> GetPersonnages();
void SetBateau(List<Bateau> listeBateaux);
void SetBestiaire(List<Bestiaire> listeBest);
void SetEquipage(List<Equipage> listeEquip);
void SetFDD(List<FruitDuDemon> listeFDD);
void SetIle(List<Ile> listeIle);
void SetPersonnage(List<Personnage> listePerso);
}
}

@ -1,8 +1,14 @@
using Model.Classes;
using Microsoft.VisualBasic;
using Model.Serializer;
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
@ -12,12 +18,23 @@ namespace Model.Managers
public class Manager
{
public IDataManager DataManager { get; set; }
public ObservableCollection<Bateau> Bateaux { get; set; }
public ObservableCollection<Personnage> Personnages { get; set; }
public ObservableCollection<FruitDuDemon> Fruits { get; set; }
public ObservableCollection<Ile> Iles { get; set; }
public ObservableCollection<Bestiaire> Bestiaire { get; set; }
public ObservableCollection<Equipage> Equipages { get; set; }
public ObjetOhara? SelectedItem { get; set; } = null;
public Manager()
{
DataManager = new StubManager();
public Manager(IDataManager dataManager) {
DataManager = dataManager;
Bateaux = new ObservableCollection<Bateau>(DataManager.GetBateaux());
Personnages = new ObservableCollection<Personnage>(DataManager.GetPersonnages());
Fruits = new ObservableCollection<FruitDuDemon>(DataManager.GetFruits());
Iles = new ObservableCollection<Ile>(DataManager.GetIles());
Bestiaire = new ObservableCollection<Bestiaire>(DataManager.GetBestiaires());
Equipages = new ObservableCollection<Equipage>(DataManager.GetEquipages());
}
public List<Personnage> GetPersonnages()
@ -88,19 +105,48 @@ namespace Model.Managers
}
return listeFDD;
}
public List<ObjetOhara> RechercheObjetOhara(string text, List<ObjetOhara> liste)
{
if (text == "")
{
return liste;
}
foreach (ObjetOhara f in liste.ToList())
{
bool correspondance = false;
int textPos = 0;
for (int i = 0; i < (f.Nom.Length); i++)
{
if (string.Equals(text[textPos].ToString(), f.Nom[i].ToString(), StringComparison.OrdinalIgnoreCase))
{
textPos++;
}
if (textPos == text.Length)
{
correspondance = true;
break;
}
}
if (!correspondance)
{
liste.Remove(f);
}
}
return liste;
}
public List<ObjetOhara> GetFavoris()
{
List<ObjetOhara> listeFavoris = new List<ObjetOhara>();
listeFavoris.AddRange(GetBateaux());
listeFavoris.AddRange(GetIles());
listeFavoris.AddRange(GetEquipages());
listeFavoris.AddRange(GetFruits());
listeFavoris.AddRange(GetBestiaires());
listeFavoris.AddRange(GetPersonnages());
foreach (ObjetOhara obj in listeFavoris.ToList())
listeFavoris.AddRange(Bateaux);
listeFavoris.AddRange(Equipages);
listeFavoris.AddRange(Bestiaire);
listeFavoris.AddRange(Fruits);
listeFavoris.AddRange(Iles);
listeFavoris.AddRange(Personnages);
foreach(ObjetOhara obj in listeFavoris.ToList())
{
if (obj.EstFavori == true)
if (obj.EstFavori == false)
{
listeFavoris.Remove(obj);
}
@ -108,9 +154,72 @@ namespace Model.Managers
return listeFavoris;
}
public void AddBateauFavoris(Bateau bateau)
public void ModifierFavoris(ObjetOhara obj,bool value)
{
bateau.EstFavori = true;
Type t = obj.GetType();
if (t.Equals(typeof(Bateau)))
foreach(Bateau b in Bateaux)
{
if (b.Equals(obj))
{
b.EstFavori = value;
DataManager.SetBateau(Bateaux.ToList());
}
}
else if (t.Equals(typeof(Equipage)))
foreach (Equipage b in Equipages)
{
if (b.Equals(obj))
{
b.EstFavori = value;
DataManager.SetEquipage(Equipages.ToList());
}
}
else if (t.Equals(typeof(Personnage)))
foreach (Personnage b in Personnages)
{
if (b.Equals(obj))
{
b.EstFavori = value;
DataManager.SetPersonnage(Personnages.ToList());
}
}
else if (t.Equals(typeof(Ile)))
foreach (Ile b in Iles)
{
if (b.Equals(obj))
{
b.EstFavori = value;
DataManager.SetIle(Iles.ToList());
}
}
else if (t.Equals(typeof(FruitDuDemon)))
foreach (FruitDuDemon b in Fruits)
{
if (b.Equals(obj))
{
b.EstFavori = true;
DataManager.SetFDD(Fruits.ToList());
}
}
else if (t.Equals(typeof(Bestiaire)))
foreach (Bestiaire b in Bestiaire)
{
if (b.Equals(obj))
{
b.EstFavori = value;
DataManager.SetBestiaire(Bestiaire.ToList());
}
}
}
}
}

@ -1,4 +1,5 @@
using System;
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
@ -12,16 +13,72 @@ namespace Model.Serializer
{
public class XML_Serializer : IDataManager
{
public string Chemin { get; set; }
public XML_Serializer()
{
StubManager stubManager = new StubManager();
Chemin = Directory.GetCurrentDirectory();
if (File.Exists(Path.Combine(Chemin, "./personnage.xml"))==false)
{
SetPersonnage(stubManager.GetPersonnages().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./bateau.xml")) == false)
{
SetBateau(stubManager.GetBateaux().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false)
{
SetFDD(stubManager.GetFruits().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./bestiaire.xml")) == false)
{
SetBestiaire(stubManager.GetBestiaires().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false)
{
SetEquipage(stubManager.GetEquipages().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./ile.xml")) == false)
{
SetIle(stubManager.GetIles().ToList());
}
}
public XML_Serializer(string path)
{
Chemin= path;
StubManager stubManager = new StubManager();
if (File.Exists(Path.Combine(Chemin, "./personnage.xml")) == false)
{
SetPersonnage(stubManager.GetPersonnages().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./bateau.xml")) == false)
{
SetBateau(stubManager.GetBateaux().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false)
{
SetFDD(stubManager.GetFruits().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./bestiaire.xml")) == false)
{
SetBestiaire(stubManager.GetBestiaires().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false)
{
SetEquipage(stubManager.GetEquipages().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./ile.xml")) == false)
{
SetIle(stubManager.GetIles().ToList());
}
}
public void SetPersonnage(List<Personnage> listePerso)
{
var serializer = new DataContractSerializer(typeof(List<Personnage>));
string xmlFile = "personnage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile))
{
@ -38,7 +95,7 @@ namespace Model.Serializer
{
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
string xmlFile = "fruitdudemon.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile))
{
@ -56,7 +113,7 @@ namespace Model.Serializer
{
var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
string xmlFile = "bestiaire.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile))
{
@ -74,7 +131,7 @@ namespace Model.Serializer
{
var serializer = new DataContractSerializer(typeof(List<Equipage>));
string xmlFile = "equipage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile))
{
@ -92,7 +149,7 @@ namespace Model.Serializer
{
var serializer = new DataContractSerializer(typeof(List<Ile>));
string xmlFile = "ile.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile))
{
@ -110,7 +167,7 @@ namespace Model.Serializer
{
var serializer = new DataContractSerializer(typeof(List<Bateau>));
string xmlFile = "bateau.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile))
{
@ -126,24 +183,26 @@ namespace Model.Serializer
public IEnumerable<Bateau> GetBateaux()
{
List<Bateau> listeBateau = new List<Bateau>();
List<Bateau>? listeBateau = new List<Bateau>();
var serializer = new DataContractSerializer(typeof(List<Bateau>));
string xmlFile = "bateau.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile))
{
listeBateau = serializer.ReadObject(s) as List<Bateau>;
}
return listeBateau;
}
public IEnumerable<Bestiaire> GetBestiaires()
{
List<Bestiaire> listeBest = new List<Bestiaire>();
List<Bestiaire>? listeBest = new List<Bestiaire>();
var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
string xmlFile = "bestiaire.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile))
{
@ -153,10 +212,10 @@ namespace Model.Serializer
}
public IEnumerable<Equipage> GetEquipages()
{
List<Equipage> listeEquip = new List<Equipage>();
List<Equipage>? listeEquip = new List<Equipage>();
var serializer = new DataContractSerializer(typeof(List<Equipage>));
string xmlFile = "equipage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile))
{
@ -166,10 +225,10 @@ namespace Model.Serializer
}
public IEnumerable<FruitDuDemon> GetFruits()
{
List<FruitDuDemon> listeFDD = new List<FruitDuDemon>();
List<FruitDuDemon>? listeFDD = new List<FruitDuDemon>();
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
string xmlFile = "fruitdudemon.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile))
{
@ -179,10 +238,10 @@ namespace Model.Serializer
}
public IEnumerable<Ile> GetIles()
{
List<Ile> listeIle = new List<Ile>();
List<Ile>? listeIle = new List<Ile>();
var serializer = new DataContractSerializer(typeof(List<Ile>));
string xmlFile = "ile.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile))
{
@ -192,10 +251,10 @@ namespace Model.Serializer
}
public IEnumerable<Personnage> GetPersonnages()
{
List<Personnage> listePerso = new List<Personnage>();
List<Personnage>? listePerso = new List<Personnage>();
var serializer = new DataContractSerializer(typeof(List<Personnage>));
string xmlFile = "personnage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "./"));
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile))
{

@ -1,4 +1,5 @@
using System;
using Model.Serializer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -10,7 +11,7 @@ namespace Model.Stub
{
public class StubManager : IDataManager
{
public StubPersonnage StubPersonnage { get; set; }
public StubFruitDuDemon StubFruitDuDemon { get; set; }
public StubEquipage StubEquipage { get; set; }
@ -20,6 +21,7 @@ namespace Model.Stub
public StubManager()
{
StubPersonnage = new StubPersonnage();
StubFruitDuDemon = new StubFruitDuDemon();
StubEquipage = new StubEquipage();
@ -54,5 +56,35 @@ namespace Model.Stub
{
return StubIle.RecupererIle();
}
public void SetBateau(List<Bateau> listeBateaux)
{
throw new NotImplementedException();
}
public void SetBestiaire(List<Bestiaire> listeBest)
{
throw new NotImplementedException();
}
public void SetEquipage(List<Equipage> listeEquip)
{
throw new NotImplementedException();
}
public void SetFDD(List<FruitDuDemon> listeFDD)
{
throw new NotImplementedException();
}
public void SetIle(List<Ile> listeIle)
{
throw new NotImplementedException();
}
public void SetPersonnage(List<Personnage> listePerso)
{
throw new NotImplementedException();
}
}
}

@ -1,15 +1,18 @@
using Model.Managers;
using Plugin.Maui.Audio;
using Model.Serializer;
using Model.Stub;
using Model.Managers;
namespace Ohara;
public partial class App : Application
{
public Manager manager { get; set; } = new Manager();
public Manager manager { get; set; } = new Manager(new XML_Serializer(FileSystem.Current.AppDataDirectory));
public App()
{
InitializeComponent();
InitializeComponent();
MainPage = new AppShell();
}
}

@ -5,28 +5,24 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Ohara"
Shell.FlyoutBehavior="Locked"
Shell.NavBarIsVisible="False"
Shell.Background="#72a3b3"
Shell.NavBarIsVisible="False"
Shell.FlyoutWidth="300"
>
<Shell.TitleView>
<Label/>
</Shell.TitleView>
<Shell.FlyoutHeader>
<StackLayout>
<Label Text="Ohara" FontSize="33" HorizontalOptions="Center"/>
<Image Source="ohara2.png" HeightRequest="300" HorizontalOptions="Center" >
<Image.Clip>
<EllipseGeometry Center="150,90" RadiusX="80" RadiusY="80"/>
</Image.Clip>
</Image>
</StackLayout>
<Shell.FlyoutHeader >
<Grid HeightRequest="200" BackgroundColor="Black" Margin="0,0,0,20">
<Image Source="ohara2.png" Aspect="Fill" Opacity="0.8" />
<Label Text="Ohara" FontSize="33" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="5" Stroke="#72a3b3" VerticalOptions="End" />
</Grid>
</Shell.FlyoutHeader>
<ShellContent Title="Accueil" ContentTemplate="{DataTemplate local:MainPage}" />
<ShellContent Title="Favoris" ContentTemplate="{DataTemplate local:PageFavoris}" />
<ShellContent Title="Carte" ContentTemplate="{DataTemplate local:PageCarte}" />
@ -37,6 +33,8 @@
<ShellContent Title="Equipages" ContentTemplate="{DataTemplate local:PageEquipage}" />
<ShellContent Title="Bestiaire" ContentTemplate="{DataTemplate local:PageBestiaire}" />
<Shell.FlyoutFooter>
<Label Text="REY Guillaume et BRUGIÈRE Yoan" HorizontalOptions="Center" Margin="10"/>
</Shell.FlyoutFooter>
</Shell>

@ -3,25 +3,25 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.MainPage"
BackgroundColor="#e2edf1">
<ScrollView>
<VerticalStackLayout Grid.Row="0" Grid.Column="1" Spacing="40" Margin="0,20,0,0">
<Frame CornerRadius="20" Margin="150,0,150,0" HeightRequest="75">
<Label Text="Bienvenue dans Ohara !" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" TextColor="White"/>
<Frame.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#cdffd8" Offset="0.1" />
<GradientStop Color="#94b9ff" Offset="1.0" />
</LinearGradientBrush>
</Frame.Background>
</Frame>
<Frame CornerRadius="20" BorderColor="#72a3b3" BackgroundColor="#72a3b3" Padding="20" HeightRequest="500" Margin="50,0,50,0">
<Label Text="Présentation :" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" TextColor="White"/>
</Frame>
<VerticalStackLayout Grid.Row="0" Grid.Column="1" Spacing="40" Margin="0,20,0,0">
<Frame CornerRadius="20" WidthRequest="600" HeightRequest="75">
<Label Text="Bienvenue dans Ohara !" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" TextColor="White"/>
<Frame.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#cdffd8" Offset="0.1" />
<GradientStop Color="#94b9ff" Offset="1.0" />
</LinearGradientBrush>
</Frame.Background>
</Frame>
<Frame CornerRadius="20" BorderColor="#72a3b3" BackgroundColor="#72a3b3" Padding="20" WidthRequest="1000" HeightRequest="500" >
<Label Text="Présentation :" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" TextColor="White"/>
</Frame>
<Frame CornerRadius="20" BorderColor="#72a3b3" BackgroundColor="#72a3b3" Padding="20" WidthRequest="1200" HeightRequest="500" >
<Label Text="Nouveautés : ..." FontAttributes="Bold" FontSize="30" HorizontalOptions="Start" TextColor="White"/>
</Frame>
</VerticalStackLayout>
<Frame CornerRadius="20" BorderColor="#72a3b3" BackgroundColor="#72a3b3" Padding="20" HeightRequest="500" Margin="50,0,50,0" >
<Label Text="Nouveautés : ..." FontAttributes="Bold" FontSize="30" HorizontalOptions="Start" TextColor="White"/>
</Frame>
</VerticalStackLayout>
</ScrollView>
</ContentPage>

@ -7,28 +7,19 @@
<VerticalStackLayout Spacing="40">
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="4">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
</Grid>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always">
<CollectionView x:Name="listeBateau" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBateau_SelectionChanged">
<CollectionView x:Name="listeBateau" ItemsSource="{Binding Bateaux}" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBateau_SelectionChanged" >
<CollectionView.ItemTemplate>
<DataTemplate>

@ -12,12 +12,18 @@ public partial class PageBateau : ContentPage
public PageBateau()
{
InitializeComponent();
listeBateau.ItemsSource = manager.GetBateaux();
BindingContext = manager;
}
async void listeBateau_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
await Navigation.PushAsync(new PageInfoBateau((Bateau)listeBateau.SelectedItem));
manager.SelectedItem = (Bateau)listeBateau.SelectedItem;
await Navigation.PushAsync(new PageInfoBateau());
}
private void Button_Clicked(object sender, EventArgs e)
{
}
}

@ -6,27 +6,22 @@
BackgroundColor="#e2edf1">
<VerticalStackLayout Spacing="20">
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
<CollectionView x:Name="listeBest" ItemsLayout="VerticalGrid, 4" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBest_SelectionChanged">
<CollectionView x:Name="listeBest" ItemsSource="{Binding Bestiaire}" ItemsLayout="VerticalGrid, 4" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBest_SelectionChanged">
<CollectionView.Header>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="4">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="20" ColumnSpacing="20" RowSpacing="20">

@ -9,17 +9,16 @@ namespace Ohara;
public partial class PageBestiaire : ContentPage
{
public Manager manager => (App.Current as App).manager;
public ICommand AjouterFavoris { get; private set; }
public PageBestiaire()
{
InitializeComponent();
//AjouterFavoris = new Command((obj) => manager.AddFavoris((ObjetOhara)obj));
listeBest.ItemsSource = manager.GetBestiaires();
BindingContext = manager;
}
async void listeBest_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
await Navigation.PushAsync(new PageInfoBestiaire((Bestiaire)listeBest.SelectedItem));
manager.SelectedItem = (Bestiaire)listeBest.SelectedItem;
await Navigation.PushAsync(new PageInfoBestiaire());
}
}

@ -5,56 +5,47 @@
Title="PageEquipage"
BackgroundColor="#e2edf1">
<ScrollView>
<VerticalStackLayout Spacing="10">
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
<CollectionView x:Name="listeEquip" ItemsLayout="VerticalGrid, 4" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeEquip_SelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="20" ColumnSpacing="20" RowSpacing="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25*"/>
</Grid.ColumnDefinitions>
<Frame Style="{StaticResource frameEquip}" >
<StackLayout Orientation="Vertical" Padding="5">
<Image Source="{Binding Image}"
HeightRequest="290"
WidthRequest="290"/>
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
<CollectionView x:Name="listeEquip" ItemsSource="{Binding Equipages}" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeEquip_SelectionChanged">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/>
</CollectionView.ItemsLayout>
<CollectionView.Header>
<Grid ColumnDefinitions="200,*,100,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="5">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Style="{StaticResource frameEquip}" >
<StackLayout Orientation="Vertical" Padding="5">
<Image Source="{Binding Image}"
HeightRequest="290"
WidthRequest="290"/>
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="19"
TextColor="White"
FontAttributes="Bold" />
</StackLayout>
</Frame>
FontSize="19"
TextColor="White"
FontAttributes="Bold" />
</StackLayout>
</Frame>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>

@ -10,13 +10,14 @@ public partial class PageEquipage : ContentPage
public PageEquipage()
{
InitializeComponent();
listeEquip.ItemsSource = manager.GetEquipages();
BindingContext = manager;
}
async void listeEquip_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
await Navigation.PushAsync(new PageInfoEquipage((Equipage)listeEquip.SelectedItem));
manager.SelectedItem=(Equipage)listeEquip.SelectedItem;
await Navigation.PushAsync(new PageInfoEquipage());
}
}

@ -1,89 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.PageFDD"
Title="PageFDD"
BackgroundColor="#e2edf1">
<VerticalStackLayout Grid.Row="0" Grid.Column="1" Spacing="10">
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0" x:Name="searchBar" />
<Frame Grid.Column="2" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" >
<Label Text="Filtrer" />
<FlyoutBase.ContextFlyout>
<MenuFlyout >
<MenuFlyoutItem x:Name="Logia" Text="Logia" />
</MenuFlyout>
</FlyoutBase.ContextFlyout>
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
<CollectionView x:Name="listeFDD" ItemsLayout="VerticalGrid, 4" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeFDD_SelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="20" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="33*"/>
</Grid.ColumnDefinitions>
<Frame Style="{StaticResource frameObjet}"
>
<StackLayout Orientation="Vertical" Padding="5">
<Image
Source="{Binding Image}"
HeightRequest="290"
WidthRequest="290" />
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="19"
TextColor="#72a3b3"
FontAttributes="Bold" />
<Label
VerticalOptions="Center"
HorizontalOptions="Center"
Text="{Binding Type}"
FontAttributes="Italic"
TextColor="#72a3b3"/>
</StackLayout>
</Frame>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.PageFDD"
Title="PageFDD"
BackgroundColor="#e2edf1">
<CollectionView x:Name="listeFDD" ItemsSource="{Binding Fruits}" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeFDD_SelectionChanged" >
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/>
</CollectionView.ItemsLayout>
<CollectionView.Header>
<Grid ColumnDefinitions="200,*,150,10,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame x:Name="Logia" CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Picker Title="Trier" Grid.Column="4" BackgroundColor="#bfe5ef">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Nom croissant</x:String>
<x:String>Nom décroissant</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate >
<DataTemplate >
<Frame Style="{StaticResource frameObjet}">
<StackLayout Orientation="Vertical" Padding="5">
<Image
Source="{Binding Image}"
HeightRequest="280"
WidthRequest="280" />
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="19"
TextColor="#72a3b3"
FontAttributes="Bold" />
<Label
VerticalOptions="Center"
HorizontalOptions="Center"
Text="{Binding Type}"
FontAttributes="Italic"
TextColor="#72a3b3"/>
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>

@ -15,16 +15,16 @@ public partial class PageFDD : ContentPage
{
InitializeComponent();
listeFDD.ItemsSource = manager.GetFruits();
BindingContext = manager;
void OnTextChanged(object sender, EventArgs e)
{
SearchBar searchBar = (SearchBar)sender;
listeFDD.ItemsSource = manager.RechercheFDD(searchBar.Text,manager.GetFruits());
listeFDD.ItemsSource = manager.RechercheFDD(searchBar.Text,manager.Fruits.ToList());
}
searchBar.TextChanged += OnTextChanged;
FiltrerType = new Command((type) => listeFDD.ItemsSource = manager.FiltrerFDD(type.ToString()));
Logia.Command = FiltrerType;
Logia.CommandParameter = "Logia";
//Logia.Command = FiltrerType;
//Logia.CommandParameter = "Logia";
}
@ -45,7 +45,7 @@ public partial class PageFDD : ContentPage
async void listeFDD_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
await Navigation.PushAsync(new PageInfoFdd((FruitDuDemon)listeFDD.SelectedItem));
manager.SelectedItem=(FruitDuDemon)listeFDD.SelectedItem;
await Navigation.PushAsync(new PageInfoFdd());
}
}

@ -1,63 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.PageFavoris"
Title="PageFavoris"
BackgroundColor="#e2edf1">
<CollectionView x:Name="listeFavs" Grid.Column="1" SelectionMode="Single" SelectionChanged="listeFavs_SelectionChanged">
<CollectionView.ItemsLayout Style="">
<GridItemsLayout Orientation="Vertical" Span="4" />
</CollectionView.ItemsLayout>
<CollectionView.Header>
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Style="{StaticResource frameObjet}" Margin="10">
<StackLayout Orientation="Vertical" Padding="5">
<Image
Source="{Binding Image}"
HeightRequest="290"
WidthRequest="290" />
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="19"
TextColor="#72a3b3"
FontAttributes="Bold" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.PageFavoris"
Title="PageFavoris"
BackgroundColor="#e2edf1">
<CollectionView x:Name="listeFavs" SelectionMode="Single" SelectionChanged="listeFavs_SelectionChanged" EmptyView="Aucun résultat trouvé.">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/>
</CollectionView.ItemsLayout>
<CollectionView.Header>
<Grid ColumnDefinitions="200,*,100,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Button Text="Actualiser" Clicked="Button_Clicked" Grid.Column="2" CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="5">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Style="{StaticResource frameObjet}">
<StackLayout Orientation="Vertical" Padding="5">
<Image
Source="{Binding Image}"
HeightRequest="290"
WidthRequest="290" />
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="19"
TextColor="#72a3b3"
FontAttributes="Bold" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>

@ -1,35 +1,74 @@
using Model.Classes;
using Model.Managers;
using Plugin.Maui.Audio;
namespace Ohara;
public partial class PageFavoris : ContentPage
{
public Manager manager => (App.Current as App).manager;
public PageFavoris()
{
InitializeComponent();
listeFavs.ItemsSource = manager.GetFavoris();
}
async void listeFavs_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Type t = listeFavs.SelectedItem.GetType();
Console.WriteLine(t);
if (t.Equals(typeof(Bateau)))
await Navigation.PushAsync(new PageInfoBateau((Bateau)listeFavs.SelectedItem));
else if (t.Equals(typeof(Equipage)))
await Navigation.PushAsync(new PageInfoEquipage((Equipage)listeFavs.SelectedItem));
else if (t.Equals(typeof(Personnage)))
await Navigation.PushAsync(new PageInfoPersonnage((Personnage)listeFavs.SelectedItem));
else if (t.Equals(typeof(Ile)))
await Navigation.PushAsync(new PageInfoIle((Ile)listeFavs.SelectedItem));
else if (t.Equals(typeof(FruitDuDemon)))
await Navigation.PushAsync(new PageInfoFdd((FruitDuDemon)listeFavs.SelectedItem));
else if (t.Equals(typeof(Bestiaire)))
await Navigation.PushAsync(new PageInfoBestiaire((Bestiaire)listeFavs.SelectedItem));
}
namespace Ohara;
public partial class PageFavoris : ContentPage
{
public Manager manager => (App.Current as App).manager;
public PageFavoris()
{
InitializeComponent();
listeFavs.ItemsSource = manager.GetFavoris();
void OnTextChanged(object sender, EventArgs e)
{
SearchBar searchBar = (SearchBar)sender;
listeFavs.ItemsSource = manager.RechercheObjetOhara(searchBar.Text, manager.GetFavoris());
}
searchBar.TextChanged += OnTextChanged;
}
void listeFavs_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Type t = listeFavs.SelectedItem.GetType();
Console.WriteLine(t);
if (t.Equals(typeof(Bateau)))
{
manager.SelectedItem = (Bateau)listeFavs.SelectedItem;
Navigation.PushAsync(new PageInfoBateau());
}
else if (t.Equals(typeof(Equipage)))
{
manager.SelectedItem = (Equipage)listeFavs.SelectedItem;
Navigation.PushAsync(new PageInfoEquipage());
}
else if (t.Equals(typeof(Personnage)))
{
manager.SelectedItem = (Personnage)listeFavs.SelectedItem;
Navigation.PushAsync(new PageInfoPersonnage());
}
else if (t.Equals(typeof(Ile)))
{
manager.SelectedItem=(Ile)listeFavs.SelectedItem;
Navigation.PushAsync(new PageInfoIle());
}
else if (t.Equals(typeof(FruitDuDemon)))
{
manager.SelectedItem = (FruitDuDemon)listeFavs.SelectedItem;
Navigation.PushAsync(new PageInfoFdd());
}
else if (t.Equals(typeof(Bestiaire)))
{
manager.SelectedItem = (Bestiaire)listeFavs.SelectedItem;
Navigation.PushAsync(new PageInfoBestiaire());
}
}
private void Button_Clicked(object sender, EventArgs e)
{
listeFavs.ItemsSource = manager.GetFavoris();
}
}

@ -7,28 +7,22 @@
<VerticalStackLayout Spacing="40">
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
<VerticalStackLayout BackgroundColor="#bfe5ef" Grid.Column="4">
<Button Text="Trier"/>
<Button Text="Nom croissant" IsVisible="False"/>
<Button Text="Nom décroissant" IsVisible="False"/>
</VerticalStackLayout>
</Grid>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always">
<CollectionView x:Name="listeIle" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeIle_SelectionChanged" >
<CollectionView x:Name="listeIle" ItemsSource="{Binding Iles}" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeIle_SelectionChanged" >
<CollectionView.ItemTemplate>
<DataTemplate>

@ -8,14 +8,17 @@ namespace Ohara;
public partial class PageIle : ContentPage
{
public Manager manager => (App.Current as App).manager;
public PageIle()
{
InitializeComponent();
listeIle.ItemsSource = manager.GetIles();
BindingContext = manager;
}
async void listeIle_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
await Navigation.PushAsync(new PageInfoIle((Ile)listeIle.SelectedItem));
manager.SelectedItem=(Ile)listeIle.SelectedItem;
await Navigation.PushAsync(new PageInfoIle());
}
}

@ -15,7 +15,8 @@
<ColumnDefinition Width="40*"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Spacing="4">
<Button x:Name="ButtonFav" Text="Ajouter aux favoris" Style="{StaticResource buttonFavsInfo}"/>
<Button x:Name="bouttonFav" Text="Ajouter aux favoris" Style="{StaticResource buttonFavsInfo}" Clicked="AjouterFav_Clicked" />
<Button x:Name="retirerFav" Text="Retirer des favoris" IsVisible="false" Style="{StaticResource buttonRetirerFavInfo}" Clicked="RetirerFav_Clicked"/>
<Frame Style="{StaticResource frameInfo}">
<Label Text="Sommaire" Style="{StaticResource titreInfo}"/>
</Frame>

@ -1,20 +1,41 @@
using Model.Stub;
using System.Windows.Input;
using Model.Classes;
using Model.Managers;
namespace Ohara;
public partial class PageInfoBateau : ContentPage
{
public ICommand AjouterFavs { get; private set; }
public PageInfoBateau(Bateau bateau)
public Manager manager => (App.Current as App).manager;
public PageInfoBateau()
{
InitializeComponent();
if(manager.SelectedItem.EstFavori==true)
{
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
BindingContext=manager.SelectedItem;
BindingContext=bateau;
AjouterFavs = new Command(() => bateau.EstFavori = true);
ButtonFav.Command = AjouterFavs;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem,true);
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
private void RetirerFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, false);
bouttonFav.IsEnabled = true;
bouttonFav.Text = "Ajouter au favoris";
retirerFav.IsVisible = false;
}
}

@ -15,6 +15,8 @@
<ColumnDefinition Width="40*"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Spacing="4">
<Button x:Name="bouttonFav" Text="Ajouter aux favoris" Style="{StaticResource buttonFavsInfo}" Clicked="AjouterFav_Clicked" />
<Button x:Name="retirerFav" Text="Retirer des favoris" IsVisible="false" Style="{StaticResource buttonRetirerFavInfo}" Clicked="RetirerFav_Clicked"/>
<Frame Style="{StaticResource frameInfo}">
<Label Text="Sommaire" Style="{StaticResource titreInfo}"/>
</Frame>

@ -1,13 +1,38 @@
using Model.Stub;
using Model.Classes;
using Model.Managers;
namespace Ohara;
public partial class PageInfoBestiaire : ContentPage
{
public PageInfoBestiaire(Bestiaire bestiaire)
public Manager manager => (App.Current as App).manager;
public PageInfoBestiaire()
{
InitializeComponent();
BindingContext=bestiaire;
if (manager.SelectedItem.EstFavori == true)
{
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
BindingContext = manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, true);
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
private void RetirerFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, false);
bouttonFav.IsEnabled = true;
bouttonFav.Text = "Ajouter au favoris";
retirerFav.IsVisible = false;
}
}

@ -16,6 +16,8 @@
<ColumnDefinition Width="40*"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Spacing="4">
<Button x:Name="bouttonFav" Text="Ajouter aux favoris" Style="{StaticResource buttonFavsInfo}" Clicked="AjouterFav_Clicked" />
<Button x:Name="retirerFav" Text="Retirer des favoris" IsVisible="false" Style="{StaticResource buttonRetirerFavInfo}" Clicked="RetirerFav_Clicked"/>
<Frame Style="{StaticResource frameInfo}">
<Label Text="Sommaire" Style="{StaticResource titreInfo}"/>
</Frame>

@ -1,13 +1,38 @@
using Model.Stub;
using Model.Classes;
using Model.Managers;
namespace Ohara;
public partial class PageInfoEquipage : ContentPage
{
public PageInfoEquipage(Equipage equipage)
public Manager manager => (App.Current as App).manager;
public PageInfoEquipage()
{
InitializeComponent();
BindingContext = equipage;
if (manager.SelectedItem.EstFavori == true)
{
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
BindingContext = manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, true);
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
private void RetirerFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, false);
bouttonFav.IsEnabled = true;
bouttonFav.Text = "Ajouter au favoris";
retirerFav.IsVisible = false;
}
}

@ -15,6 +15,8 @@
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Spacing="2" Padding="5">
<Button x:Name="bouttonFav" Text="Ajouter aux favoris" Style="{StaticResource buttonFavsInfo}" Clicked="AjouterFav_Clicked" />
<Button x:Name="retirerFav" Text="Retirer des favoris" IsVisible="false" Style="{StaticResource buttonRetirerFavInfo}" Clicked="RetirerFav_Clicked"/>
<Frame Style="{StaticResource frameInfo}">
<Label Text="Sommaire :" Style="{StaticResource titreInfo}" />
</Frame>

@ -1,13 +1,38 @@
using Model.Classes;
using Model.Stub;
using Model.Managers;
namespace Ohara;
public partial class PageInfoFdd : ContentPage
{
public PageInfoFdd(FruitDuDemon fdd)
public Manager manager => (App.Current as App).manager;
public PageInfoFdd()
{
InitializeComponent();
BindingContext = fdd;
if (manager.SelectedItem.EstFavori == true)
{
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
BindingContext = manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, true);
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
private void RetirerFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, false);
bouttonFav.IsEnabled = true;
bouttonFav.Text = "Ajouter au favoris";
retirerFav.IsVisible = false;
}
}

@ -15,7 +15,9 @@
<ColumnDefinition Width="40*"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Spacing="4">
<Frame Style="{StaticResource frameInfo}">
<Button x:Name="bouttonFav" Text="Ajouter aux favoris" Style="{StaticResource buttonFavsInfo}" Clicked="AjouterFav_Clicked" />
<Button x:Name="retirerFav" Text="Retirer des favoris" IsVisible="false" Style="{StaticResource buttonRetirerFavInfo}" Clicked="RetirerFav_Clicked"/>
<Frame Style="{StaticResource frameInfo}">
<Label Text="Sommaire" Style="{StaticResource titreInfo}"/>
</Frame>
<Frame Style="{StaticResource frameInfo}">

@ -1,13 +1,38 @@
using Model.Stub;
using Model.Classes;
using Model.Managers;
namespace Ohara;
public partial class PageInfoIle : ContentPage
{
public PageInfoIle(Ile ile)
public Manager manager => (App.Current as App).manager;
public PageInfoIle()
{
InitializeComponent();
BindingContext = ile;
if (manager.SelectedItem.EstFavori == true)
{
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
BindingContext = manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, true);
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
private void RetirerFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, false);
bouttonFav.IsEnabled = true;
bouttonFav.Text = "Ajouter au favoris";
retirerFav.IsVisible = false;
}
}

@ -15,6 +15,8 @@
<ColumnDefinition Width="40*"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Spacing="4">
<Button x:Name="bouttonFav" Text="Ajouter aux favoris" Style="{StaticResource buttonFavsInfo}" Clicked="AjouterFav_Clicked" />
<Button x:Name="retirerFav" Text="Retirer des favoris" IsVisible="false" Style="{StaticResource buttonRetirerFavInfo}" Clicked="RetirerFav_Clicked"/>
<Frame Style="{StaticResource frameInfo}">
<Label Text="Sommaire" Style="{StaticResource titreInfo}"/>
</Frame>

@ -1,14 +1,39 @@
using Model.Stub;
using Plugin.Maui.Audio;
using Model.Managers;
using Model.Classes;
namespace Ohara;
public partial class PageInfoPersonnage : ContentPage
{
public PageInfoPersonnage(Personnage perso)
public Manager manager => (App.Current as App).manager;
public PageInfoPersonnage()
{
InitializeComponent();
BindingContext = perso;
if (manager.SelectedItem.EstFavori == true)
{
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
BindingContext = manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, true);
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
private void RetirerFav_Clicked(object sender, EventArgs e)
{
manager.ModifierFavoris(manager.SelectedItem, false);
bouttonFav.IsEnabled = true;
bouttonFav.Text = "Ajouter au favoris";
retirerFav.IsVisible = false;
}
}

@ -7,28 +7,20 @@
<VerticalStackLayout Spacing="40">
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="4">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always">
<CollectionView x:Name="listePerso" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listePerso_SelectionChanged">
</Grid>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always">
<CollectionView x:Name="listePerso" ItemsSource="{Binding Personnages}" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listePerso_SelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate>
@ -83,12 +75,4 @@
</ScrollView>
</VerticalStackLayout>
<!--<Rectangle WidthRequest="200" HeightRequest="300" HorizontalOptions="Start" BackgroundColor="#72a3b3">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="#cdffd8" Offset="0.0" />-->
<!--<GradientStop Color="#94b9ff" Offset="1.0" /></LinearGradientBrush></Rectangle.Fill></Rectangle>-->
</ContentPage>

@ -11,15 +11,18 @@ public partial class PagePersonnage : ContentPage
public Manager manager => (App.Current as App).manager;
public PagePersonnage()
{
InitializeComponent();
listePerso.ItemsSource = manager.GetPersonnages();
BindingContext = manager;
}
async void listePerso_SelectionChanged(object sender, SelectionChangedEventArgs e)
void listePerso_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
await Navigation.PushAsync(new PageInfoPersonnage((Personnage)listePerso.SelectedItem));
manager.SelectedItem = (Personnage)listePerso.SelectedItem;
Navigation.PushAsync(new PageInfoPersonnage());
}
}

@ -669,6 +669,16 @@
<Setter Property="TextColor" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Padding" Value="17"/>
<Setter Property="BorderColor" Value="Transparent"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Grey"/>
<Setter Property="TextColor" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Padding" Value="17"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
@ -676,4 +686,47 @@
</Setter>
</Style>
<Style TargetType="Button" x:Key="buttonRetirerFavInfo">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup>
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="DarkRed"/>
<Setter Property="TextColor" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Padding" Value="17"/>
<Setter Property="BorderColor" Value="DarkRed"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Red"/>
<Setter Property="TextColor" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Padding" Value="17"/>
<Setter Property="BorderColor" Value="Red"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<!--<Style TargetType="Label"
Class="FlyoutItemLabelStyle">
<Setter Property="TextColor"
Value="White" />
<Setter Property="WidthRequest" Value="250"/>
<Setter Property="HorizontalOptions" Value="Center"/>
</Style>
<Style TargetType="Layout"
Class="FlyoutItemLayoutStyle"
ApplyToDerivedTypes="True">
<Setter Property="BackgroundColor"
Value="Teal" />
</Style>-->
</ResourceDictionary>

@ -1,27 +1,142 @@
// See https://aka.ms/new-console-template for more information
using Model;
using Model.Classes;
using Model.Serializer;
using Model.Managers;
using System.Collections.ObjectModel;
// var manager = new Manager();
var xml = new XML_Serializer();
// Tests fonctionnels :
Manager manager = new Manager(new XML_Serializer());
//Tests paramètres du manager :
Bestiaire luffy = new Bestiaire("test", "", "", "");
/*
xml.SetPersonnage(manager.GetPersonnages().ToList());
xml.SetFDD(manager.GetFruits().ToList());
xml.SetBateau(manager.GetBateaux().ToList());
xml.SetBestiaire(manager.GetBestiaires().ToList());
xml.SetEquipage(manager.GetEquipages().ToList());
xml.SetIle(manager.GetIles().ToList());
*/
foreach (Bateau b in manager.Bateaux)
{
Console.WriteLine(b);
}
Type t = luffy.GetType();
if (t.Equals(typeof(Bestiaire)))
Console.WriteLine(luffy.Nom);
foreach (Bestiaire b in manager.Bestiaire)
{
Console.WriteLine(b);
}
Console.WriteLine(t.Equals(typeof(Bestiaire)));
foreach (Equipage e in manager.Equipages)
{
Console.WriteLine(e);
}
foreach (FruitDuDemon f in manager.Fruits)
{
Console.WriteLine(f);
}
foreach (Personnage p in manager.Personnages)
{
Console.WriteLine(p);
}
Console.WriteLine("\n");
Console.WriteLine("\n");
foreach (Bateau b in manager.Bateaux)
{
manager.ModifierFavoris(b, false);
}
//Tests serialization :
XML_Serializer serializer = new XML_Serializer();
//Affichage d'un objet à son état initiale
Console.WriteLine(manager.Bateaux[0]);
//Modification de cet objet
manager.ModifierFavoris(manager.Bateaux[0], true);
Console.WriteLine(manager.Bateaux[0]);
//Serialization de la liste contenant l'objet
serializer.SetBateau(manager.Bateaux.ToList());
//Netoyage de la liste
manager.Bateaux.Clear();
//Deserialization dans la liste
manager.Bateaux = new ObservableCollection<Bateau>(serializer.GetBateaux());
//Affichage de l'objet précedement modifié
Console.WriteLine(manager.Bateaux[0]);
Console.WriteLine("\n");
Console.WriteLine("\n");
//Tests méthode du manager :
foreach (Bateau b in manager.Bateaux)
{
manager.ModifierFavoris(b, false);
}
//Ajout d'un objet en favoris
manager.ModifierFavoris(manager.Bateaux[0],true);
foreach (ObjetOhara o in manager.GetFavoris())
{
Console.WriteLine(o.Nom);
}
//Suppréssion d'un objet des favoris
manager.ModifierFavoris(manager.Bateaux[0], false);
foreach (ObjetOhara o in manager.GetFavoris())
{
Console.WriteLine(o.Nom);
}
Console.WriteLine("\n");
Console.WriteLine("\n");
// Filtre des fruits du démon pour afficher seulement les type "Logia"
foreach (FruitDuDemon f in manager.FiltrerFDD("Logia"))
{
Console.WriteLine(f.Nom+" "+f.Type);
}
Console.WriteLine("\n");
Console.WriteLine("\n");
// Recherche dansune liste de fruit de démon pour afficher les fruits correspondant au mot clé "Nika"
foreach (FruitDuDemon f in manager.RechercheFDD("Nika",manager.Fruits.ToList()))
{
Console.WriteLine(f.Nom);
}
Console.WriteLine("\n");
Console.WriteLine("\n");
foreach (Bateau b in manager.Bateaux)
{
manager.ModifierFavoris(b,true);
}
// Recherche dansune liste de objet ohara pour afficher les objets ohara correspondant au mot clé "Sunny"
foreach (ObjetOhara o in manager.RechercheObjetOhara("Sunny", manager.GetFavoris()))
{
Console.WriteLine(o.Nom);
}
Console.WriteLine("\n");
Console.WriteLine("\n");
ObservableCollection<Bateau> bateaux = new ObservableCollection<Bateau>(manager.GetBateaux());
foreach(Bateau b in bateaux)
{
Console.WriteLine(b);
}
ObservableCollection<Bestiaire> bestiaire = new ObservableCollection<Bestiaire>(manager.GetBestiaires());
foreach (Bestiaire b in bestiaire)
{
Console.WriteLine(b);
}
ObservableCollection<Equipage> equipage = new ObservableCollection<Equipage>(manager.GetEquipages());
foreach (Equipage e in equipage)
{
Console.WriteLine(e);
}
ObservableCollection<FruitDuDemon> fruits = new ObservableCollection<FruitDuDemon>(manager.GetFruits());
foreach (FruitDuDemon f in fruits)
{
Console.WriteLine(f);
}
ObservableCollection<Personnage> personnages = new ObservableCollection<Personnage>(manager.GetPersonnages());
foreach (Personnage p in personnages)
{
Console.WriteLine(p);
}

Loading…
Cancel
Save