Merge pull request 'Barre de Recherche' (#59) from yvan into master
continuous-integration/drone/push Build is failing Details

Reviewed-on: remi.lavergne/SAE2.01-IHM_-_Remi_LAVERGNE_-_Yvan_CALATAYUD#59
pull/63/head
Yvan CALATAYUD 2 years ago
commit d27dd7817a

@ -11,10 +11,24 @@ namespace GameAtlas.Models
{ {
public class Manager : INotifyPropertyChanged public class Manager : INotifyPropertyChanged
{ {
public ObservableCollection<Jeu> ListJeux { get; private set; }
public List<Admin> Admins { get; private set; } public List<Admin> Admins { get; private set; }
public List<Utilisateur> Utilisateurs { get; private set; } public List<Utilisateur> Utilisateurs { get; private set; }
private ObservableCollection<Jeu> listJeux;
public ObservableCollection<Jeu> ListJeux
{
get
{
return listJeux;
}
set
{
listJeux = value;
OnPropertyChanged();
}
}
public IPersistanceManager Persistance { get; set; } public IPersistanceManager Persistance { get; set; }
public Utilisateur ConnectedUser public Utilisateur ConnectedUser

@ -25,6 +25,7 @@
BackgroundColor="White" BackgroundColor="White"
TextColor="Black" TextColor="Black"
HorizontalOptions="Center" HorizontalOptions="Center"
TextChanged="SearchBar_TextChanged"
/> />
<Label <Label
@ -36,7 +37,7 @@
/> />
<Grid> <Grid>
<CollectionView ItemsSource="{Binding ListJeux}" Margin="0,10,0,0" VerticalScrollBarVisibility="Never"> <CollectionView ItemsSource="{Binding ListJeux}" Margin="0,10,0,0" VerticalScrollBarVisibility="Never" x:Name="searchResults">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border HeightRequest="97.5" StrokeShape="RoundRectangle 5" VerticalOptions="Start" HorizontalOptions="Center"> <Border HeightRequest="97.5" StrokeShape="RoundRectangle 5" VerticalOptions="Start" HorizontalOptions="Center">

@ -1,6 +1,7 @@
namespace GameAtlas.Views; namespace GameAtlas.Views;
using GameAtlas.Models; using GameAtlas.Models;
using System.Collections.ObjectModel;
public partial class PageParcourir : ContentPage public partial class PageParcourir : ContentPage
{ {
@ -27,4 +28,16 @@ public partial class PageParcourir : ContentPage
{ {
await Navigation.PopAsync(); await Navigation.PopAsync();
} }
private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
{
if(string.IsNullOrWhiteSpace(e.NewTextValue))
{
searchResults.ItemsSource = ParcourirManager.ListJeux;
}
else
{
searchResults.ItemsSource = ParcourirManager.ListJeux.Where(i => i.Nom.ToLower().Contains(e.NewTextValue.ToLower()));
}
}
} }
Loading…
Cancel
Save