You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.5 KiB
81 lines
2.5 KiB
|
|
using Model.Classes;
|
|
using Model.Managers;
|
|
|
|
namespace Ohara;
|
|
|
|
public partial class PageFavoris : ContentPage
|
|
{
|
|
public Manager manager => (App.Current as App).manager;
|
|
|
|
public PageFavoris()
|
|
{
|
|
InitializeComponent();
|
|
BindableLayout.SetItemsSource(listeFav, manager.GetFavoris());
|
|
void OnTextChanged(object sender, EventArgs e)
|
|
{
|
|
SearchBar searchBar = (SearchBar)sender;
|
|
BindableLayout.SetItemsSource(listeFav, manager.RechercheObjetOhara(searchBar.Text, manager.GetFavoris().ToList()));
|
|
}
|
|
searchBar.TextChanged += OnTextChanged;
|
|
|
|
}
|
|
private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
|
|
{
|
|
|
|
ObjetOhara SelectedItem = manager.GetFavoris().FirstOrDefault(p => p.Nom == (((TappedEventArgs)e).Parameter.ToString()));
|
|
if (SelectedItem != null)
|
|
{
|
|
manager.SelectedItem = SelectedItem;
|
|
Type t = manager.SelectedItem.GetType();
|
|
if (t.Equals(typeof(Bateau)))
|
|
{
|
|
await Shell.Current.GoToAsync(nameof(PageInfoBateau));
|
|
}
|
|
else if (t.Equals(typeof(Equipage)))
|
|
{
|
|
await Shell.Current.GoToAsync(nameof(PageInfoEquipage));
|
|
}
|
|
else if (t.Equals(typeof(Personnage)))
|
|
{
|
|
await Shell.Current.GoToAsync(nameof(PageInfoPersonnage));
|
|
}
|
|
else if (t.Equals(typeof(Ile)))
|
|
{
|
|
await Shell.Current.GoToAsync(nameof(PageInfoIle));
|
|
}
|
|
else if (t.Equals(typeof(FruitDuDemon)))
|
|
{
|
|
|
|
await Shell.Current.GoToAsync(nameof(PageInfoFdd));
|
|
}
|
|
else if (t.Equals(typeof(Bestiaire)))
|
|
{
|
|
await Shell.Current.GoToAsync(nameof(PageInfoBestiaire));
|
|
}
|
|
}
|
|
|
|
}
|
|
private void ContentPage_Appearing(object sender, EventArgs e)
|
|
{
|
|
BindableLayout.SetItemsSource(listeFav, manager.GetFavoris());
|
|
|
|
}
|
|
|
|
private void PickerFiltre_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
var picker = (Picker)sender;
|
|
int selectedIndex = picker.SelectedIndex;
|
|
if (selectedIndex == 0)
|
|
{
|
|
BindableLayout.SetItemsSource(listeFav, manager.GetFavoris());
|
|
}
|
|
else
|
|
{
|
|
// listeFavs.ItemsSource = manager.FiltrerFDD((string)picker.ItemsSource[selectedIndex]).ToList();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
} |