private async void TaskPanel_NoteInputModeChanged()

in FamilyNotes/MainPage.xaml.cs [800:831]


        private async void TaskPanel_NoteInputModeChanged(object sender, InputModeChangedEventArgs e)
        {
            // Transition out of dictation mode. 
            if (_speechManager.RecognitionMode == SpeechRecognitionMode.Dictation && 
                e.NewInputMode != NoteInputMode.Dictation)
            {
                if ((bool)VoiceCommandButton.IsChecked)
                {
                    EnableVoiceCommands();
                }
                else
                {
                    DisableVoiceCommands();
                }
            }
            // Transition to dictation mode. 
            else if (_speechManager.RecognitionMode != SpeechRecognitionMode.Dictation &&
                e.NewInputMode == NoteInputMode.Dictation)
            {
                await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
                {
                    if (await _speechManager.SetRecognitionMode(SpeechRecognitionMode.Dictation))
                    {
                        await _speechManager.SpeakAsync("Dictate your note", _media);
                    }
                    else
                    {
                        e.SourceNote.InputMode = NoteInputMode.Default;
                    }
                });
            }
        }