@ -1,6 +1,6 @@
using Microsoft.Maui.Controls.PlatformConfiguration ;
using MusiLib.Model ;
using System.Diagnostics ;
namespace MusiLib.Views ;
@ -35,8 +35,8 @@ public partial class Partition : ContentPage
IPlayMusic . pauseMusic ( ) ;
button . Text = "Jouer" ;
}
}
private void Stop_Music ( object sender , EventArgs e )
{
IPlayMusic . stopMusic ( ) ;
@ -49,4 +49,24 @@ public partial class Partition : ContentPage
IPlayMusic . stopMusic ( ) ;
return base . OnBackButtonPressed ( ) ;
}
protected override void OnDisappearing ( )
{
base . OnDisappearing ( ) ;
IPlayMusic . stopMusic ( ) ;
}
protected override void OnAppearing ( )
{
base . OnAppearing ( ) ;
Shell . Current . Navigating + = Shell_Navigating ;
}
private void Shell_Navigating ( object sender , ShellNavigatingEventArgs e )
{
if ( e . Source = = ShellNavigationSource . ShellItemChanged )
{
IPlayMusic . stopMusic ( ) ;
}
}
}