Ejemplo n.º 1
0
        private async void tocarSom(string filename)
        {
            try
            {
                //var player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

                try
                {
                    if (player.IsPlaying)
                    {
                        player.Stop();
                    }
                    else
                    {
                        player.Load(filename);

                        player.Play();
                    }
                }
                catch (Exception ex)
                {
                    player.Stop();

                    throw new Exception(ex.Message);
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Atenção", ex.Message, "OK");
            }
        }
Ejemplo n.º 2
0
 public Task Stop()
 {
     _audioStreamPlayer.Stop();
     _audioStreamPlayer.Dispose();
     _audioStream.Dispose();
     return(Task.Delay(0));
 }
Ejemplo n.º 3
0
 // Theme Sounds start
 public void StopSounds()
 {
     if (allSounds.IsPlaying)
     {
         allSounds.Stop();
     }
 }
Ejemplo n.º 4
0
 private void SoundStop01()
 {
     if (playerAlarm.IsPlaying)
     {
         playerAlarm.Stop();
     }
 }
Ejemplo n.º 5
0
 private void SoundStop02()
 {
     if (playerWood.IsPlaying)
     {
         playerWood.Stop();
     }
 }
Ejemplo n.º 6
0
 private void SoundStop03()
 {
     if (playerF1.IsPlaying)
     {
         playerF1.Stop();
     }
 }
Ejemplo n.º 7
0
        private async Task IntruderMode()
        {
            int timer = CommonHelper.IntruderModeTimer;

            for (int second = 0; second < timer; second++)
            {
                Notifications.Insert(0, new NotificationModel()
                {
                    Date    = DateTime.Now,
                    Message = "You didn't say the magic word",
                    Tag     = "Error"
                });
                if (second == 5)
                {
                    PlaySound();
                    ShowDeniedImage = true;
                }

                await Task.Delay(500);
            }
            _player.Stop();
            ShowDeniedImage = false;
            _intruderMode   = false;
            await LoadData();
        }
Ejemplo n.º 8
0
        private void PlayCurrentSound() // pour que le son s'execute encore si le laser monte et descend
        {
            ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

            player.Stop();
            player.Play();
        }
Ejemplo n.º 9
0
        public void StopAreaMusic()
        {
            if (areaMusicPlayer == null)
            {
                areaMusicPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            }
            try
            {
                if (areaMusicPlayer.IsPlaying)
                {
                    areaMusicPlayer.Stop();
                }
            }
            catch (Exception ex)
            {
            }

            if (areaAmbientSoundsPlayer == null)
            {
                areaAmbientSoundsPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            }
            try
            {
                if (areaAmbientSoundsPlayer.IsPlaying)
                {
                    areaAmbientSoundsPlayer.Stop();
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 10
0
        // Returns to the previous page when an area outside the popup is clicked
        private async void CloseAllPopup()
        {
            player.Stop();
            await PopupNavigation.Instance.PopAsync();

            player.Dispose();
            player = null;
        }
 protected override void OnDisappearing()
 {
     AudioPlaying = false;
     if (player != null)
     {
         if ((player.IsPlaying == true) && (player != null))
         {
             player.Stop();
         }
     }
     if (timer != null)
     {
         timer.StopTimer();
     }
     BufferingAudioStatus(false);
 }
Ejemplo n.º 12
0
 protected override bool OnBackButtonPressed()
 {
     if (!stl_StartMenu.IsVisible)
     {
         stl_SaveDataMenu.IsVisible = false;
         stl_SaveDataMenu.Opacity   = 0;
         frm_NewUser.IsVisible      = false;
         frm_NewUser.Scale          = .1;
         stl_StartMenu.Opacity      = 1;
         stl_StartMenu.IsVisible    = true;
         return(true);
     }
     else
     {
         IntroTheme.Stop();
         return(false);
     }
 }