diff --git a/Sources/Vues/Collection.xaml b/Sources/Vues/Collection.xaml index 48c1d61..41302da 100644 --- a/Sources/Vues/Collection.xaml +++ b/Sources/Vues/Collection.xaml @@ -4,51 +4,29 @@ x:Class="Vues.Collection" BackgroundImageSource="backcollection.jpg" > - + - + - + - - - - - - - - - - - - - + + + + + + + + - - + \ No newline at end of file diff --git a/Sources/Vues/Collection.xaml.cs b/Sources/Vues/Collection.xaml.cs index c66c5d2..e04a015 100644 --- a/Sources/Vues/Collection.xaml.cs +++ b/Sources/Vues/Collection.xaml.cs @@ -1,9 +1,53 @@ +using Model; +using System.Collections.ObjectModel; +using System.ComponentModel; + namespace Vues; -public partial class Collection : ContentPage +public partial class Collection : ContentPage, INotifyPropertyChanged { - public Collection() + public ObservableCollection MnstrTemp = (Application.Current as App).monsterManager.ListMonsters; + + public Collection() { InitializeComponent(); + BindingContext = this; } + private void UpdateListMobs() + { + var monstresDejaVu = MnstrTemp.Where(monstre => (Application.Current as App).User.monstresDejaVu.Contains(monstre)).ToList(); + var monstresPasVu = MnstrTemp.Except((Application.Current as App).User.monstresDejaVu).ToList(); + var listMobs = new ObservableCollection(); + listMobs.Clear(); + + if (CheckboxdejaVu.IsChecked && CheckboxpasVu.IsChecked) + { + var concatMonstres = monstresDejaVu.Concat(monstresPasVu); + listMobs = new ObservableCollection(concatMonstres); + } + else if (CheckboxdejaVu.IsChecked) + { + listMobs = new ObservableCollection(monstresDejaVu); + } + else if (CheckboxpasVu.IsChecked) + { + listMobs = new ObservableCollection(monstresPasVu); + } + else + { + listMobs = new ObservableCollection(); + } + } + + private void CheckedVu(object sender, CheckedChangedEventArgs e) + { + UpdateListMobs(); + } + + private void CheckedPasVu(object sender, CheckedChangedEventArgs e) + { + UpdateListMobs(); + } + + } \ No newline at end of file diff --git a/Sources/Vues/Resources/Images/book.png b/Sources/Vues/Resources/Images/book.png new file mode 100644 index 0000000..43cf9ce Binary files /dev/null and b/Sources/Vues/Resources/Images/book.png differ diff --git a/Sources/Vues/SearchMob.xaml b/Sources/Vues/SearchMob.xaml index 8ff09ac..0108dda 100644 --- a/Sources/Vues/SearchMob.xaml +++ b/Sources/Vues/SearchMob.xaml @@ -63,7 +63,8 @@ BackgroundColor="{StaticResource buttonBackgroundColor}"> - + + - + diff --git a/Sources/Vues/SearchMob.xaml.cs b/Sources/Vues/SearchMob.xaml.cs index 5e81902..8ceea19 100644 --- a/Sources/Vues/SearchMob.xaml.cs +++ b/Sources/Vues/SearchMob.xaml.cs @@ -151,4 +151,40 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged } + private async void CollectionClicked(object sender, EventArgs e) + { + await Navigation.PushAsync(new Collection()); + } + + private async void QuitClicked(object sender, EventArgs e) + { + (Application.Current as App).User = null; + await Navigation.PushAsync(new Accueil()); + } + + private void CheckBox_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + /* + if (CheckDejaVu.IsChecked) + { + if ((App.Current as App).User != null) + { + (Application.Current as App).MonstreSelectionne.IsChecked = true; + (Application.Current as App).User.monstresDejaVu.Add((Application.Current as App).MonstreSelectionne); + } + } + else + { + if ((App.Current as App).User != null) + { + (Application.Current as App).MonstreSelectionne.IsChecked = false; + (Application.Current as App).User.monstresDejaVu.Remove((Application.Current as App).MonstreSelectionne); + } + } + */ + + ///Si checkbox check + ///add le monstre courant à la liste des monstre du user + ///si unchecked, retirer le monsrte + } } \ No newline at end of file