internal SapiRecognizer(RecognizerType type) { ISpRecognizer spRecognizer; try { spRecognizer = ((type != 0) ? ((ISpRecognizer) new SpSharedRecognizer()) : ((ISpRecognizer) new SpInprocRecognizer())); _isSap53 = (spRecognizer is ISpRecognizer2); } catch (COMException e) { throw RecognizerBase.ExceptionFromSapiCreateRecognizerError(e); } if (!IsSapi53 && Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) { Marshal.ReleaseComObject(spRecognizer); _proxy = new SapiProxy.MTAThread(type); } else { _proxy = new SapiProxy.PassThrough(spRecognizer); } }
internal SapiGrammar(ISpRecoGrammar sapiGrammar, SapiProxy thread) { _sapiGrammar = sapiGrammar; _sapiProxy = thread; }
// This constructor must be called in the context of the background proxy if any internal SapiRecoContext(ISpRecoContext recoContext, SapiProxy proxy) { _recoContext = recoContext; _proxy = proxy; }