示例#1
0
        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);
            }
        }
示例#2
0
 internal SapiGrammar(ISpRecoGrammar sapiGrammar, SapiProxy thread)
 {
     _sapiGrammar = sapiGrammar;
     _sapiProxy   = thread;
 }
示例#3
0
 // This constructor must be called in the context of the background proxy if any
 internal SapiRecoContext(ISpRecoContext recoContext, SapiProxy proxy)
 {
     _recoContext = recoContext;
     _proxy       = proxy;
 }