|
|
|
@ -11,12 +11,14 @@ public partial class Favoris : ContentPage, IAllowClick
|
|
|
|
|
|
|
|
|
|
private List<Partition> partitionsInitiales;
|
|
|
|
|
private List<Partition> partitionsFiltrees;
|
|
|
|
|
private Trier trieur;
|
|
|
|
|
|
|
|
|
|
public Favoris()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
partitionsInitiales = MyManager.favoris.ToList();
|
|
|
|
|
partitionsFiltrees = new List<Partition>(partitionsInitiales);
|
|
|
|
|
trieur = new Trier(MyManager.favoris.ToList());
|
|
|
|
|
chargerFavoris();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -123,6 +125,72 @@ public partial class Favoris : ContentPage, IAllowClick
|
|
|
|
|
chargerFavoris();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void TriButton_Clicked(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var action = await DisplayActionSheet("Trier par", "Annuler", null, "Type", "Difficulté", "Ordre alphabétique", "Réinitialiser");
|
|
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
|
{
|
|
|
|
|
case "Type":
|
|
|
|
|
await TrierParTypeButton();
|
|
|
|
|
break;
|
|
|
|
|
case "Difficulté":
|
|
|
|
|
await TrierParDifficulteButton();
|
|
|
|
|
break;
|
|
|
|
|
case "Ordre alphabétique":
|
|
|
|
|
await TrierParOrdreAlphabetiqueButton();
|
|
|
|
|
break;
|
|
|
|
|
case "Réinitialiser":
|
|
|
|
|
ReinitialiserButton();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task TrierParTypeButton()
|
|
|
|
|
{
|
|
|
|
|
var action = await DisplayActionSheet("Trier par", "Annuler", null, "Batterie", "Guitare", "Piano");
|
|
|
|
|
|
|
|
|
|
if (action == "Annuler")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var partitionsTriees = trieur.TrierParInstrument(action);
|
|
|
|
|
partitionsFiltrees = new List<Partition>(partitionsTriees);
|
|
|
|
|
chargerFavoris();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task TrierParDifficulteButton()
|
|
|
|
|
{
|
|
|
|
|
var action = await DisplayActionSheet("Trier par", "Annuler", null, "Facile", "Moyen", "Difficile");
|
|
|
|
|
|
|
|
|
|
if (action == "Annuler")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var partitionsTriees = trieur.TrierParComplexite(action);
|
|
|
|
|
partitionsFiltrees = new List<Partition>(partitionsTriees);
|
|
|
|
|
chargerFavoris();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task TrierParOrdreAlphabetiqueButton()
|
|
|
|
|
{
|
|
|
|
|
var action = await DisplayActionSheet("Trier par", "Annuler", null, "Croissant", "Décroissant");
|
|
|
|
|
|
|
|
|
|
if (action == "Annuler")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var partitionsTriees = trieur.TrierParOrdreAlphabetique(action);
|
|
|
|
|
partitionsFiltrees = new List<Partition>(partitionsTriees);
|
|
|
|
|
chargerFavoris();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ReinitialiserButton()
|
|
|
|
|
{
|
|
|
|
|
partitionsFiltrees.Clear();
|
|
|
|
|
partitionsFiltrees.AddRange(partitionsInitiales);
|
|
|
|
|
chargerFavoris();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnAppearing()
|
|
|
|
|
{
|
|
|
|
|
base.OnAppearing();
|
|
|
|
|