Merge pull request 'Collection' (#38) from Collection into develop
continuous-integration/drone/push Build is passing Details

Reviewed-on: #38
develop
Nicolas BLONDEAU 2 years ago
commit 33200d002a

@ -4,51 +4,29 @@
x:Class="Vues.Collection"
BackgroundImageSource="backcollection.jpg"
>
<VerticalStackLayout
>
<VerticalStackLayout>
<HorizontalStackLayout BackgroundColor="{StaticResource buttonBackgroundColor}">
<Label Text=" Monstre déjà vu"></Label>
<CheckBox
Color="{StaticResource BleuFonce}"></CheckBox>
<CheckBox x:Name="CheckboxdejaVu"
Color="{StaticResource BleuFonce}"
IsChecked="True"
CheckedChanged="CheckedVu"></CheckBox>
<Label Text=" Monstre jamais vu"></Label>
<CheckBox Color="{StaticResource BleuFonce}"></CheckBox>
<CheckBox x:Name="CheckboxpasVu"
Color="{StaticResource BleuFonce}"
CheckedChanged="CheckedPasVu"></CheckBox>
</HorizontalStackLayout>
<Line X1="0" Y1="0" X2="1500" Y2="0" Stroke="Black" StrokeThickness="2"/>
<FlexLayout
Wrap="Wrap">
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<Image Source="cartedragon.png"
HeightRequest="300"
Margin="5, 5, 0, 0"></Image>
<FlexLayout>
<ListView ItemsSource="{Binding listMobs}" BackgroundColor="White">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Nom}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</FlexLayout>
</VerticalStackLayout>
</ContentPage>

@ -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<Monstre> 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<Monstre>();
listMobs.Clear();
if (CheckboxdejaVu.IsChecked && CheckboxpasVu.IsChecked)
{
var concatMonstres = monstresDejaVu.Concat(monstresPasVu);
listMobs = new ObservableCollection<Monstre>(concatMonstres);
}
else if (CheckboxdejaVu.IsChecked)
{
listMobs = new ObservableCollection<Monstre>(monstresDejaVu);
}
else if (CheckboxpasVu.IsChecked)
{
listMobs = new ObservableCollection<Monstre>(monstresPasVu);
}
else
{
listMobs = new ObservableCollection<Monstre>();
}
}
private void CheckedVu(object sender, CheckedChangedEventArgs e)
{
UpdateListMobs();
}
private void CheckedPasVu(object sender, CheckedChangedEventArgs e)
{
UpdateListMobs();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@ -63,7 +63,8 @@
BackgroundColor="{StaticResource buttonBackgroundColor}">
<VerticalStackLayout>
<HorizontalStackLayout Grid.Row="0">
<ImageButton Source="exit.png" WidthRequest="20" BackgroundColor="{StaticResource buttonBackgroundColor}"/>
<ImageButton Source="exit.png" WidthRequest="20" BackgroundColor="{StaticResource buttonBackgroundColor}" Clicked="QuitClicked"/>
<ImageButton Source="book.png" WidthRequest="20" BackgroundColor="{StaticResource buttonBackgroundColor}" Clicked="CollectionClicked"/>
<SearchBar x:Name="searchBar" Placeholder="Rechercher un monstre"
PlaceholderColor="DimGray"
CancelButtonColor="DimGray"
@ -135,10 +136,10 @@
<!-- Grid du Detail contenant toutes les informations du monstre -->
<Grid RowDefinitions="Auto,Auto,Auto,Auto" BindingContext="{Binding SelectedItem, Source={x:Reference ListViewMonsters}}">
<Grid ColumnDefinitions="3*, *" Grid.Row="0">
<!-- Checkbox "Déjà Vu-->
<HorizontalStackLayout Grid.Column="0" VerticalOptions="Start">
<Label Text="Déjà vu ?" FontSize="20" TextColor="White" Margin="7"/>
<CheckBox Color="Green"/>
<CheckBox Color="Green" CheckedChanged="CheckBox_CheckedChanged" x:Name="CheckDejaVu"/>
</HorizontalStackLayout>
<VerticalStackLayout VerticalOptions="Center" Grid.Column="0">

@ -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
}
}
Loading…
Cancel
Save