private void InvokeControlerAsync(object arg) { VicCmd vc = arg as VicCmd; if (vc != null) { controler.SendCommand(vc.Command); } }
/// <summary> /// 绑定到语音识别结果事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void grammar_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { VicCmd vc = vicDic[e.Result.Text]; lbRecognizedText.Text = e.Result.Text; Thread t = new Thread(InvokeControlerAsync); t.Start(vc); }