Speech SDK 5.1 语音转换文字有关问题,帮小弟我把上面的vb.net 改成c

Speech SDK 5.1 语音转换文字问题,帮我把下面的vb.net 改成c#
下面的vb.net 看不懂,哪位帮个忙,改成c#的,谢谢!!!



需要下载MS的语音识别SDK开发包

speechsdk51.exe
speechsdk51LangPack.exe
speechsdk51MSM.exe



windows程序版的搞定了,web应用程序来实现怎么也不行 

贴出windows版的结帖了 
Private WithEvents RecoContext As SpeechLib.SpSharedRecoContext 
Private Grammar As SpeechLib.ISpeechRecoGrammar 

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click 
  System.Diagnostics.Debug.Assert(Not m_bRecoRunning, " ") 

  ' Initialize recognition context object and grammar object, then 
  ' start dictation 
  If (RecoContext Is Nothing) Then 
  System.Diagnostics.Debug.WriteLine( "Initializing SAPI reco context object... ") 
  RecoContext = New SpeechLib.SpSharedRecoContext 
  Grammar = RecoContext.CreateGrammar(1) 
  Grammar.DictationLoad() 
  End If 

  Grammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSActive) 
End Sub 

Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click 
  System.Diagnostics.Debug.Assert(m_bRecoRunning, " ") 
  Grammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSInactive) End Sub 

Private Sub RecoContext_Recognition(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) Handles RecoContext.Recognition 
  Dim strText As String 
  strText = Result.PhraseInfo.GetText 
  System.Diagnostics.Debug.WriteLine( "Recognition: " & strText & ", " & StreamNumber & ", " & StreamPosition) 
  txtSpeech.SelectionStart = m_cChars 
  txtSpeech.SelectionText = strText & " " 
  m_cChars = m_cChars + 1 + Len(strText)  
End Sub










------解决方案--------------------
private SpeechLib.SpSharedRecoContext RecoContext;
private SpeechLib.ISpeechRecoGrammar Grammar;

private void btnStart_Click(System.Object sender, System.EventArgs e)
{
System.Diagnostics.Debug.Assert(!m_bRecoRunning, " ");

// Initialize recognition context object and grammar object, then 
// start dictation 
if (RecoContext == null)
{
System.Diagnostics.Debug.WriteLine("Initializing SAPI reco context object... ");
RecoContext = new SpeechLib.SpSharedRecoContext();
RecoContext.Recognition += RecoContext_Recognition;
Grammar = RecoContext.CreateGrammar(1);
Grammar.DictationLoad();
}

Grammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSActive);
}

private void btnStop_Click(System.Object sender, System.EventArgs e)
{
System.Diagnostics.Debug.Assert(m_bRecoRunning, " ");
Grammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSInactive);
}

private void RecoContext_Recognition(int StreamNumber, Object StreamPosition, SpeechLib.SpeechRecognitionType RecognitionType, SpeechLib.ISpeechRecoResult Result)