private async void OnToggleRecording(object sender, RoutedEventArgs e)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            if (IsRecording)
            {
                var result = await _token.StopAsync();
                IsRecording = false;

                TrySaveAudio(result.FilePath);
            }
            else
            {
                _token = await new Recorder().StartAsync();
                IsRecording = true;
            }

            IsBusy = false;
        }
Exemple #2
0
        private async void OnToggleRecording(object sender, RoutedEventArgs e)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            if (IsRecording)
            {
                var result = await _token.StopAsync();

                IsRecording = false;

                TrySaveAudio(result.FilePath);
            }
            else
            {
                _token      = await new Recorder().StartAsync();
                IsRecording = true;
            }

            IsBusy = false;
        }