@ -25,6 +25,8 @@ public partial class PartitionView : ContentPage
IdTab = id ;
IdTab = id ;
Part . BindingContext = MyManager . partitions [ IdTab ] ;
Part . BindingContext = MyManager . partitions [ IdTab ] ;
Part2 . BindingContext = MyManager ;
Part2 . BindingContext = MyManager ;
InitializeButton ( ) ;
}
}
private void Play_Music ( object sender , EventArgs e )
private void Play_Music ( object sender , EventArgs e )
@ -80,15 +82,31 @@ public partial class PartitionView : ContentPage
}
}
}
}
private void InitializeButton ( )
{
if ( Utilisateur . Favoris . Contains ( MyManager . partitions [ IdTab ] ) )
{
favoriButton . Source = "etoile.png" ;
}
else
{
favoriButton . Source = "etoile_vide.png" ;
}
}
private void AddFavoriButton ( object sender , EventArgs e )
private void AddFavoriButton ( object sender , EventArgs e )
{
{
ImageButton button = ( ImageButton ) sender ;
if ( ! Utilisateur . Favoris . Contains ( MyManager . partitions [ IdTab ] ) )
if ( ! Utilisateur . Favoris . Contains ( MyManager . partitions [ IdTab ] ) )
{
{
Utilisateur . Favoris . Add ( MyManager . partitions [ IdTab ] ) ;
Utilisateur . Favoris . Add ( MyManager . partitions [ IdTab ] ) ;
button . Source = "etoile.png" ;
}
}
else
else
{
{
Utilisateur . Favoris . Remove ( MyManager . partitions [ IdTab ] ) ;
Utilisateur . Favoris . Remove ( MyManager . partitions [ IdTab ] ) ;
button . Source = "etoile_vide.png" ;
}
}
}
}
}
}