/// <summary>
 /// Запускает голосовое управление
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void VoiceButtonClicked(object sender, EventArgs e)
 {
     try
     {
         Vibration.Vibrate();
         BottomPanel.IsEnabled         = false;
         VoiceButton.IsEnabled         = false;
         BottomBoxView.BackgroundColor = Color.FromHex("#C00000");
         if (await AudioRecording.CheckAudioPermissions())
         {
             await AudioRecording.RecordAudio();
             await AnalizeAudioCommand(AudioRecording.RecorderPath);
         }
         BottomPanel.IsEnabled         = true;
         VoiceButton.IsEnabled         = true;
         BottomBoxView.BackgroundColor = Color.Black;
     }
     catch (Exception)
     {
         await Navigation.PushAsync(new SomethingWentWrongPage());
     }
     finally
     {
         BottomPanel.IsEnabled         = true;
         VoiceButton.IsEnabled         = true;
         BottomBoxView.BackgroundColor = Color.Black;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Запускает голосовое управление
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void RecordAndAnalyze(object sender, EventArgs e)
        {
            try
            {
                MainGrid.IsEnabled = false;
                Vibration.Vibrate();
                BottomPanel.BackgroundColor = Color.FromHex("#C00000");

                if (await AudioRecording.CheckAudioPermissions())
                {
                    await AudioRecording.RecordAudio();
                    await AnalizeCommandHandwritten();
                }
            }
            catch (Exception)
            {
                await Navigation.PushAsync(new SomethingWentWrongPage());
            }
            finally
            {
                MainGrid.IsEnabled          = true;
                BottomPanel.BackgroundColor = Color.Black;
            }
        }