@ -1,43 +1,60 @@
|
|||||||
namespace GameAtlas.Views;
|
namespace GameAtlas.Views
|
||||||
|
|
||||||
using Models;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
public partial class PageParcourir : ContentPage
|
|
||||||
{
|
{
|
||||||
|
using Models;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
public Manager ParcourirManager => (App.Current as App).MyManager;
|
/// <summary>
|
||||||
public PageParcourir()
|
/// Code-Behind pour la page parcourir.
|
||||||
{
|
/// </summary>
|
||||||
InitializeComponent();
|
public partial class PageParcourir : ContentPage
|
||||||
BindingContext = ParcourirManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
async void OnGame_Tapped(System.Object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu;
|
/// <summary>
|
||||||
if (selectedjeu != null)
|
/// Gestionnaire de parcours.
|
||||||
|
/// </summary>
|
||||||
|
public Manager ParcourirManager => (App.Current as App).MyManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructeur de la page de parcours.
|
||||||
|
/// </summary>
|
||||||
|
public PageParcourir()
|
||||||
{
|
{
|
||||||
|
InitializeComponent();
|
||||||
await Navigation.PushAsync(new PageJeu(selectedjeu));
|
BindingContext = ParcourirManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async void Back_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
|
/// <summary>
|
||||||
{
|
/// Méthode appelée lorsqu'un jeu est sélectionné.
|
||||||
await Navigation.PopAsync();
|
/// </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)
|
/// <summary>
|
||||||
{
|
/// Méthode appelée lorsqu'on appuie sur l'icône de retour.
|
||||||
if(string.IsNullOrWhiteSpace(e.NewTextValue))
|
/// </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