Persistance fonctionnelle et nouveaux bindings
continuous-integration/drone/push Build is failing Details

pull/15/head
Yoan BRUGIÈRE 2 years ago
parent 70f1b2fd33
commit f03cc7ae78

@ -14,5 +14,11 @@ namespace Model
IEnumerable<FruitDuDemon> GetFruits(); IEnumerable<FruitDuDemon> GetFruits();
IEnumerable<Ile> GetIles(); IEnumerable<Ile> GetIles();
IEnumerable<Personnage> GetPersonnages(); 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);
} }
} }

@ -16,7 +16,6 @@ namespace Model
public class Manager public class Manager
{ {
public IDataManager DataManager { get; set; } public IDataManager DataManager { get; set; }
public XML_Serializer XML_Serializer { get; set; }
public ObservableCollection<Bateau> Bateaux { get; set; } public ObservableCollection<Bateau> Bateaux { get; set; }
public ObservableCollection<Personnage> Personnages { get; set; } public ObservableCollection<Personnage> Personnages { get; set; }
public ObservableCollection<FruitDuDemon> Fruits { get; set; } public ObservableCollection<FruitDuDemon> Fruits { get; set; }
@ -26,18 +25,10 @@ namespace Model
public ObjetOhara? SelectedItem { get; set; } = null; public ObjetOhara? SelectedItem { get; set; } = null;
public Manager() { public Manager(IDataManager dataManager) {
DataManager = new StubManager(); DataManager = dataManager;
XML_Serializer = new XML_Serializer();
if (File.Exists(@"C:\Users\yobrugiere1\Documents\Ohara\Sources\Ohara\Resources\XML\bateau.xml"))
Bateaux = new ObservableCollection<Bateau>(XML_Serializer.GetBateaux());
else
Bateaux = new ObservableCollection<Bateau>(DataManager.GetBateaux()); Bateaux = new ObservableCollection<Bateau>(DataManager.GetBateaux());
if (File.Exists(@"C:\Users\yobrugiere1\Documents\Ohara\Sources\Ohara\Resources\XML\personnage.xml"))
Personnages = new ObservableCollection<Personnage>(XML_Serializer.GetPersonnages());
else
Personnages = new ObservableCollection<Personnage>(DataManager.GetPersonnages()); Personnages = new ObservableCollection<Personnage>(DataManager.GetPersonnages());
Fruits = new ObservableCollection<FruitDuDemon>(DataManager.GetFruits()); Fruits = new ObservableCollection<FruitDuDemon>(DataManager.GetFruits());
Iles = new ObservableCollection<Ile>(DataManager.GetIles()); Iles = new ObservableCollection<Ile>(DataManager.GetIles());
Bestiaire = new ObservableCollection<Bestiaire>(DataManager.GetBestiaires()); Bestiaire = new ObservableCollection<Bestiaire>(DataManager.GetBestiaires());
@ -170,7 +161,7 @@ namespace Model
if (b.Equals(obj)) if (b.Equals(obj))
{ {
b.EstFavori = value; b.EstFavori = value;
XML_Serializer.SetBateau(Bateaux.ToList()); DataManager.SetBateau(Bateaux.ToList());
} }
} }
else if (t.Equals(typeof(Equipage))) else if (t.Equals(typeof(Equipage)))
@ -179,7 +170,7 @@ namespace Model
if (b.Equals(obj)) if (b.Equals(obj))
{ {
b.EstFavori = value; b.EstFavori = value;
XML_Serializer.SetEquipage(Equipages.ToList()); DataManager.SetEquipage(Equipages.ToList());
} }
} }
@ -189,7 +180,7 @@ namespace Model
if (b.Equals(obj)) if (b.Equals(obj))
{ {
b.EstFavori = value; b.EstFavori = value;
XML_Serializer.SetPersonnage(Personnages.ToList()); DataManager.SetPersonnage(Personnages.ToList());
} }
} }
@ -199,7 +190,7 @@ namespace Model
if (b.Equals(obj)) if (b.Equals(obj))
{ {
b.EstFavori = value; b.EstFavori = value;
XML_Serializer.SetIle(Iles.ToList()); DataManager.SetIle(Iles.ToList());
} }
} }
@ -209,7 +200,7 @@ namespace Model
if (b.Equals(obj)) if (b.Equals(obj))
{ {
b.EstFavori = true; b.EstFavori = true;
XML_Serializer.SetFDD(Fruits.ToList()); DataManager.SetFDD(Fruits.ToList());
} }
} }
@ -219,7 +210,7 @@ namespace Model
if (b.Equals(obj)) if (b.Equals(obj))
{ {
b.EstFavori = value; b.EstFavori = value;
XML_Serializer.SetBestiaire(Bestiaire.ToList()); DataManager.SetBestiaire(Bestiaire.ToList());
} }
} }

@ -1,4 +1,5 @@
using System; using Model.Stub;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
@ -10,16 +11,72 @@ namespace Model.Serializer
{ {
public class XML_Serializer : IDataManager public class XML_Serializer : IDataManager
{ {
public string Chemin { get; set; }
public XML_Serializer() 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) public void SetPersonnage(List<Personnage> listePerso)
{ {
var serializer = new DataContractSerializer(typeof(List<Personnage>)); var serializer = new DataContractSerializer(typeof(List<Personnage>));
string xmlFile = "personnage.xml"; string xmlFile = "personnage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true }; XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile)) using (TextWriter tw = File.CreateText(xmlFile))
{ {
@ -36,7 +93,7 @@ namespace Model.Serializer
{ {
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>)); var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
string xmlFile = "fruitdudemon.xml"; string xmlFile = "fruitdudemon.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true }; XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile)) using (TextWriter tw = File.CreateText(xmlFile))
{ {
@ -54,7 +111,7 @@ namespace Model.Serializer
{ {
var serializer = new DataContractSerializer(typeof(List<Bestiaire>)); var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
string xmlFile = "bestiaire.xml"; string xmlFile = "bestiaire.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true }; XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile)) using (TextWriter tw = File.CreateText(xmlFile))
{ {
@ -72,7 +129,7 @@ namespace Model.Serializer
{ {
var serializer = new DataContractSerializer(typeof(List<Equipage>)); var serializer = new DataContractSerializer(typeof(List<Equipage>));
string xmlFile = "equipage.xml"; string xmlFile = "equipage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true }; XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile)) using (TextWriter tw = File.CreateText(xmlFile))
{ {
@ -90,7 +147,7 @@ namespace Model.Serializer
{ {
var serializer = new DataContractSerializer(typeof(List<Ile>)); var serializer = new DataContractSerializer(typeof(List<Ile>));
string xmlFile = "ile.xml"; string xmlFile = "ile.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true }; XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile)) using (TextWriter tw = File.CreateText(xmlFile))
{ {
@ -108,7 +165,7 @@ namespace Model.Serializer
{ {
var serializer = new DataContractSerializer(typeof(List<Bateau>)); var serializer = new DataContractSerializer(typeof(List<Bateau>));
string xmlFile = "bateau.xml"; string xmlFile = "bateau.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true }; XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(xmlFile)) using (TextWriter tw = File.CreateText(xmlFile))
{ {
@ -127,7 +184,7 @@ namespace Model.Serializer
List<Bateau> listeBateau = new List<Bateau>(); List<Bateau> listeBateau = new List<Bateau>();
var serializer = new DataContractSerializer(typeof(List<Bateau>)); var serializer = new DataContractSerializer(typeof(List<Bateau>));
string xmlFile = "bateau.xml"; string xmlFile = "bateau.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile)) using (Stream s = File.OpenRead(xmlFile))
{ {
@ -141,7 +198,7 @@ namespace Model.Serializer
List<Bestiaire> listeBest = new List<Bestiaire>(); List<Bestiaire> listeBest = new List<Bestiaire>();
var serializer = new DataContractSerializer(typeof(List<Bestiaire>)); var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
string xmlFile = "bestiaire.xml"; string xmlFile = "bestiaire.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile)) using (Stream s = File.OpenRead(xmlFile))
{ {
@ -154,7 +211,7 @@ namespace Model.Serializer
List<Equipage> listeEquip = new List<Equipage>(); List<Equipage> listeEquip = new List<Equipage>();
var serializer = new DataContractSerializer(typeof(List<Equipage>)); var serializer = new DataContractSerializer(typeof(List<Equipage>));
string xmlFile = "equipage.xml"; string xmlFile = "equipage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile)) using (Stream s = File.OpenRead(xmlFile))
{ {
@ -167,7 +224,7 @@ namespace Model.Serializer
List<FruitDuDemon> listeFDD = new List<FruitDuDemon>(); List<FruitDuDemon> listeFDD = new List<FruitDuDemon>();
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>)); var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
string xmlFile = "fruitdudemon.xml"; string xmlFile = "fruitdudemon.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile)) using (Stream s = File.OpenRead(xmlFile))
{ {
@ -180,7 +237,7 @@ namespace Model.Serializer
List<Ile> listeIle = new List<Ile>(); List<Ile> listeIle = new List<Ile>();
var serializer = new DataContractSerializer(typeof(List<Ile>)); var serializer = new DataContractSerializer(typeof(List<Ile>));
string xmlFile = "ile.xml"; string xmlFile = "ile.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile)) using (Stream s = File.OpenRead(xmlFile))
{ {
@ -193,7 +250,7 @@ namespace Model.Serializer
List<Personnage> listePerso = new List<Personnage>(); List<Personnage> listePerso = new List<Personnage>();
var serializer = new DataContractSerializer(typeof(List<Personnage>)); var serializer = new DataContractSerializer(typeof(List<Personnage>));
string xmlFile = "personnage.xml"; string xmlFile = "personnage.xml";
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML")); Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
using (Stream s = File.OpenRead(xmlFile)) using (Stream s = File.OpenRead(xmlFile))
{ {

@ -1,4 +1,5 @@
using System; using Model.Serializer;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -18,6 +19,7 @@ namespace Model.Stub
public StubManager() public StubManager()
{ {
StubPersonnage = new StubPersonnage(); StubPersonnage = new StubPersonnage();
StubFruitDuDemon = new StubFruitDuDemon(); StubFruitDuDemon = new StubFruitDuDemon();
StubEquipage = new StubEquipage(); StubEquipage = new StubEquipage();
@ -52,5 +54,35 @@ namespace Model.Stub
{ {
return StubIle.RecupererIle(); 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,11 +1,14 @@
using Model; using Model;
using Model.Serializer;
using Model.Stub;
using Plugin.Maui.Audio; using Plugin.Maui.Audio;
namespace Ohara; namespace Ohara;
public partial class App : Application 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() public App()
{ {
InitializeComponent(); InitializeComponent();

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

@ -8,7 +8,7 @@
<VerticalStackLayout Spacing="20"> <VerticalStackLayout Spacing="20">
<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> <CollectionView.Header>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10"> <Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>

@ -12,7 +12,7 @@ public partial class PageBestiaire : ContentPage
public PageBestiaire() public PageBestiaire()
{ {
InitializeComponent(); InitializeComponent();
listeBest.ItemsSource = manager.GetBestiaires(); BindingContext = manager;
} }
async void listeBest_SelectionChanged(object sender, SelectionChangedEventArgs e) async void listeBest_SelectionChanged(object sender, SelectionChangedEventArgs e)

@ -7,48 +7,26 @@
<CollectionView x:Name="listeEquip" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeEquip_SelectionChanged"> <CollectionView x:Name="listeEquip" ItemsSource="{Binding Equipages}" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeEquip_SelectionChanged">
<CollectionView.ItemsLayout> <CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/> <GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/>
</CollectionView.ItemsLayout> </CollectionView.ItemsLayout>
<CollectionView.Header> <CollectionView.Header>
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" > <Grid ColumnDefinitions="200,*,100,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<Grid.RowDefinitions> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<RowDefinition Height="10*"/> <Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
</Grid.RowDefinitions> <Label Text="Filtrer" HorizontalTextAlignment="Center" />
<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>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="5">
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Label Text="Trier" HorizontalTextAlignment="Center" /> <Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame> </Frame>
</Grid> </Grid>
</CollectionView.Header> </CollectionView.Header>
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Padding="20" ColumnSpacing="20" RowSpacing="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25*"/>
</Grid.ColumnDefinitions>
<Frame Style="{StaticResource frameEquip}" > <Frame Style="{StaticResource frameEquip}" >
<StackLayout Orientation="Vertical" Padding="5"> <StackLayout Orientation="Vertical" Padding="5">
<Image Source="{Binding Image}" <Image Source="{Binding Image}"
@ -66,7 +44,7 @@
</StackLayout> </StackLayout>
</Frame> </Frame>
</Grid>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>

@ -9,7 +9,8 @@ public partial class PageEquipage : ContentPage
public PageEquipage() public PageEquipage()
{ {
InitializeComponent(); InitializeComponent();
listeEquip.ItemsSource = manager.GetEquipages(); BindingContext = manager;
} }
async void listeEquip_SelectionChanged(object sender, SelectionChangedEventArgs e) async void listeEquip_SelectionChanged(object sender, SelectionChangedEventArgs e)

@ -7,20 +7,25 @@
<CollectionView x:Name="listeFDD" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeFDD_SelectionChanged" > <CollectionView x:Name="listeFDD" ItemsSource="{Binding Fruits}" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeFDD_SelectionChanged" >
<CollectionView.ItemsLayout> <CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/> <GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/>
</CollectionView.ItemsLayout> </CollectionView.ItemsLayout>
<CollectionView.Header> <CollectionView.Header>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10"> <Grid ColumnDefinitions="200,*,150,10,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame x:Name="Logia" CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2"> <Frame x:Name="Logia" CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" /> <Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame> </Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="4"> <Picker Title="Trier" Grid.Column="4" BackgroundColor="#bfe5ef">
<Label Text="Trier" HorizontalTextAlignment="Center" /> <Picker.ItemsSource>
</Frame> <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> </Grid>
</CollectionView.Header> </CollectionView.Header>

@ -14,11 +14,11 @@ public partial class PageFDD : ContentPage
{ {
InitializeComponent(); InitializeComponent();
listeFDD.ItemsSource = manager.GetFruits(); BindingContext = manager;
void OnTextChanged(object sender, EventArgs e) void OnTextChanged(object sender, EventArgs e)
{ {
SearchBar searchBar = (SearchBar)sender; SearchBar searchBar = (SearchBar)sender;
listeFDD.ItemsSource = manager.RechercheFDD(searchBar.Text,manager.GetFruits()); listeFDD.ItemsSource = manager.RechercheFDD(searchBar.Text,manager.Fruits.ToList());
} }
searchBar.TextChanged += OnTextChanged; searchBar.TextChanged += OnTextChanged;
FiltrerType = new Command((type) => listeFDD.ItemsSource = manager.FiltrerFDD(type.ToString())); FiltrerType = new Command((type) => listeFDD.ItemsSource = manager.FiltrerFDD(type.ToString()));

@ -7,28 +7,22 @@
<VerticalStackLayout Spacing="40"> <VerticalStackLayout Spacing="40">
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" > <Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<Grid.RowDefinitions> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<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"> <Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" /> <Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame> </Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3"> <VerticalStackLayout BackgroundColor="#bfe5ef" Grid.Column="4">
<Label Text="Trier" HorizontalTextAlignment="Center" /> <Button Text="Trier"/>
</Frame> <Button Text="Nom croissant" IsVisible="False"/>
<Button Text="Nom décroissant" IsVisible="False"/>
</VerticalStackLayout>
</Grid> </Grid>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always"> <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> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>

@ -7,10 +7,12 @@ namespace Ohara;
public partial class PageIle : ContentPage public partial class PageIle : ContentPage
{ {
public Manager manager => (App.Current as App).manager; public Manager manager => (App.Current as App).manager;
public PageIle() public PageIle()
{ {
InitializeComponent(); InitializeComponent();
listeIle.ItemsSource = manager.GetIles(); BindingContext = manager;
} }
async void listeIle_SelectionChanged(object sender, SelectionChangedEventArgs e) async void listeIle_SelectionChanged(object sender, SelectionChangedEventArgs e)

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

@ -13,7 +13,7 @@ public partial class PagePersonnage : ContentPage
InitializeComponent(); InitializeComponent();
listePerso.ItemsSource = manager.GetPersonnages(); BindingContext = manager;
} }
void listePerso_SelectionChanged(object sender, SelectionChangedEventArgs e) void listePerso_SelectionChanged(object sender, SelectionChangedEventArgs e)

Loading…
Cancel
Save