コード例 #1
0
        /// <summary>
        /// Shows recognized text to UI.
        /// </summary>
        private void Recognizer_VoiceRecognized(object sender, VoiceRecognizedEventArgs e)
        {
            this.Dispatcher.BeginInvoke(new Action(delegate()
            {
                var result = new ResultsData(DateTime.Now.ToLongTimeString(), e.RecognizedText);

                Properties.Settings.Default.Reload();

                // Save result to log file.
                if (Properties.Settings.Default.AutomaticallySaveText)
                {
                    var sw = new StreamWriter(Properties.Settings.Default.DefaultLogFile, true);
                    sw.WriteLine(e.RecognizedText);
                    sw.Close();
                }

                // Show result
                recordedText.Items.Add(result);
            }));
        }
コード例 #2
0
        /// <summary>
        /// Shows recognized text to UI.
        /// </summary>
        private void Recognizer_VoiceRecognized(object sender, VoiceRecognizedEventArgs e)
        {
            this.Dispatcher.BeginInvoke(new Action(delegate()
            {
                var result = new ResultsData(DateTime.Now.ToLongTimeString(), e.RecognizedText);

                Properties.Settings.Default.Reload();

                // Save result to log file.
                if (Properties.Settings.Default.AutomaticallySaveText)
                {
                    var sw = new StreamWriter(Properties.Settings.Default.DefaultLogFile, true);
                    sw.WriteLine(e.RecognizedText);
                    sw.Close();
                }

                // Show result
                recordedText.Items.Add(result);
            }));
        }