|
|
|
@ -11,6 +11,8 @@ public partial class PartitionView : ContentPage
|
|
|
|
|
|
|
|
|
|
public Manager MyManager => (App.Current as App).MyManager;
|
|
|
|
|
|
|
|
|
|
public Metronome music = new Metronome();
|
|
|
|
|
public Metronome metronome = new Metronome();
|
|
|
|
|
public int IdTab { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -32,41 +34,65 @@ public partial class PartitionView : ContentPage
|
|
|
|
|
|
|
|
|
|
private void Play_Music(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Button button = (Button)sender;
|
|
|
|
|
if (!music.isMusicBeginning)
|
|
|
|
|
{
|
|
|
|
|
_ = music.Lancer(MyManager.partitions[IdTab].Son);
|
|
|
|
|
button.Text = "Pause";
|
|
|
|
|
}
|
|
|
|
|
else if(!music.isMusicPlaying)
|
|
|
|
|
{
|
|
|
|
|
music.PlayMusic();
|
|
|
|
|
button.Text = "Pause";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
music.PauseMusic();
|
|
|
|
|
button.Text = "Jouer";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Play_Metronome(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Button button = (Button)sender;
|
|
|
|
|
if (!IPlayMusic.isMusicBeginning)
|
|
|
|
|
if (!metronome.isMusicBeginning)
|
|
|
|
|
{
|
|
|
|
|
IPlayMusic.beginMusic(MyManager.partitions[IdTab].Son);
|
|
|
|
|
_ = metronome.Lancer(MyManager.partitions[IdTab].Son);
|
|
|
|
|
button.Text = "Pause";
|
|
|
|
|
}
|
|
|
|
|
else if(!IPlayMusic.isMusicPlaying)
|
|
|
|
|
else if (!metronome.isMusicPlaying)
|
|
|
|
|
{
|
|
|
|
|
IPlayMusic.playMusic();
|
|
|
|
|
metronome.PlayMusic();
|
|
|
|
|
button.Text = "Pause";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
IPlayMusic.pauseMusic();
|
|
|
|
|
metronome.PauseMusic();
|
|
|
|
|
button.Text = "Jouer";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Stop_Music(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
IPlayMusic.stopMusic();
|
|
|
|
|
music.StopMusic();
|
|
|
|
|
Button button = (Button)FindByName("play_music_button");
|
|
|
|
|
button.Text = "Jouer";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnBackButtonPressed()
|
|
|
|
|
{
|
|
|
|
|
IPlayMusic.stopMusic();
|
|
|
|
|
metronome.StopMusic();
|
|
|
|
|
music.StopMusic();
|
|
|
|
|
return base.OnBackButtonPressed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnDisappearing()
|
|
|
|
|
{
|
|
|
|
|
base.OnDisappearing();
|
|
|
|
|
IPlayMusic.stopMusic();
|
|
|
|
|
metronome.StopMusic();
|
|
|
|
|
music.StopMusic();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnAppearing()
|
|
|
|
@ -79,7 +105,8 @@ public partial class PartitionView : ContentPage
|
|
|
|
|
{
|
|
|
|
|
if (e.Source == ShellNavigationSource.ShellItemChanged)
|
|
|
|
|
{
|
|
|
|
|
IPlayMusic.stopMusic();
|
|
|
|
|
metronome.StopMusic();
|
|
|
|
|
music.StopMusic();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -116,6 +143,6 @@ public partial class PartitionView : ContentPage
|
|
|
|
|
private void TempoSlider(object sender, ValueChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
float selectedValue = (float)e.NewValue;
|
|
|
|
|
IPlayMusic.reglerTempo(selectedValue);
|
|
|
|
|
music.ReglerTempo(selectedValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|