@ -1,43 +1,60 @@
|
||||
namespace GameAtlas.Views;
|
||||
|
||||
using Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
public partial class PageParcourir : ContentPage
|
||||
namespace GameAtlas.Views
|
||||
{
|
||||
using Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
public Manager ParcourirManager => (App.Current as App).MyManager;
|
||||
public PageParcourir()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = ParcourirManager;
|
||||
}
|
||||
|
||||
async void OnGame_Tapped(System.Object sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// Code-Behind pour la page parcourir.
|
||||
/// </summary>
|
||||
public partial class PageParcourir : ContentPage
|
||||
{
|
||||
var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu;
|
||||
if (selectedjeu != null)
|
||||
/// <summary>
|
||||
/// Gestionnaire de parcours.
|
||||
/// </summary>
|
||||
public Manager ParcourirManager => (App.Current as App).MyManager;
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur de la page de parcours.
|
||||
/// </summary>
|
||||
public PageParcourir()
|
||||
{
|
||||
|
||||
await Navigation.PushAsync(new PageJeu(selectedjeu));
|
||||
InitializeComponent();
|
||||
BindingContext = ParcourirManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async void Back_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// Méthode appelée lorsqu'un jeu est sélectionné.
|
||||
/// </summary>
|
||||
async void OnGame_Tapped(System.Object sender, EventArgs e)
|
||||
{
|
||||
var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu;
|
||||
if (selectedjeu != null)
|
||||
{
|
||||
await Navigation.PushAsync(new PageJeu(selectedjeu));
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(e.NewTextValue))
|
||||
/// <summary>
|
||||
/// Méthode appelée lorsqu'on appuie sur l'icône de retour.
|
||||
/// </summary>
|
||||
async void Back_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
|
||||
{
|
||||
searchResults.ItemsSource = ParcourirManager.ListJeux;
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
else
|
||||
|
||||
/// <summary>
|
||||
/// Méthode appelée lorsque le texte de la barre de recherche change.
|
||||
/// </summary>
|
||||
private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
searchResults.ItemsSource = ParcourirManager.ListJeux.Where(i => i.Nom.ToLower().Contains(e.NewTextValue.ToLower()));
|
||||
if (string.IsNullOrWhiteSpace(e.NewTextValue))
|
||||
{
|
||||
searchResults.ItemsSource = ParcourirManager.ListJeux;
|
||||
}
|
||||
else
|
||||
{
|
||||
searchResults.ItemsSource = ParcourirManager.ListJeux.Where(i => i.Nom.ToLower().Contains(e.NewTextValue.ToLower()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue