Beispiel #1
0
        private void RunDoAction(object threadContext)
        {
            MappingActionAsyncResult asyncResult = (MappingActionAsyncResult)threadContext;
            MappingResultState       resultState = new MappingResultState();

            try
            {
                DoAction(asyncResult.PropertyBag, asyncResult.RangeIndex, asyncResult.ActionId);
            }
            catch (LinguisticException linguisticException)
            {
                resultState = linguisticException.ResultState;
            }
            asyncResult.SetResult(asyncResult.PropertyBag, resultState);

            // Don't catch any exceptions.
            try
            {
                asyncResult.AsyncCallback(asyncResult);
            }
            finally
            {
                Thread.MemoryBarrier();
                ((ManualResetEvent)asyncResult.AsyncWaitHandle).Set();
            }
        }
Beispiel #2
0
        private void RunRecognizeText(object threadContext)
        {
            MappingRecognizeAsyncResult asyncResult = (MappingRecognizeAsyncResult)threadContext;
            MappingResultState          resultState = new MappingResultState();
            MappingPropertyBag          bag         = null;

            try
            {
                bag = this.RecognizeText(asyncResult.Text, asyncResult.Length, asyncResult.Index, asyncResult.Options);
            }
            catch (LinguisticException linguisticException)
            {
                resultState = linguisticException.ResultState;
            }
            asyncResult.SetResult(bag, resultState);
            // Don't catch any exceptions.
            try
            {
                asyncResult.AsyncCallback(asyncResult);
            }
            finally
            {
                Thread.MemoryBarrier();
                ((ManualResetEvent)asyncResult.AsyncWaitHandle).Set();
            }
        }
Beispiel #3
0
        private void RunDoAction(object threadContext)
        {
            MappingActionAsyncResult asyncResult = (MappingActionAsyncResult)threadContext;
            MappingResultState resultState = new MappingResultState();
            try
            {
                DoAction(asyncResult.PropertyBag, asyncResult.RangeIndex, asyncResult.ActionId);
            }
            catch (LinguisticException linguisticException)
            {
                resultState = linguisticException.ResultState;
            }
            asyncResult.SetResult(asyncResult.PropertyBag, resultState);

            // Don't catch any exceptions.
            try
            {
                asyncResult.AsyncCallback(asyncResult);
            }
            finally
            {
                Thread.MemoryBarrier();
                ((ManualResetEvent)asyncResult.AsyncWaitHandle).Set();
            }
        }
Beispiel #4
0
 private void RunRecognizeText(object threadContext)
 {
     MappingRecognizeAsyncResult asyncResult = (MappingRecognizeAsyncResult)threadContext;
     MappingResultState resultState = new MappingResultState();
     MappingPropertyBag bag = null;
     try
     {
         bag = this.RecognizeText(asyncResult.Text, asyncResult.Length, asyncResult.Index, asyncResult.Options);
     }
     catch (LinguisticException linguisticException)
     {
         resultState = linguisticException.ResultState;
     }
     asyncResult.SetResult(bag, resultState);
     // Don't catch any exceptions.
     try
     {
         asyncResult.AsyncCallback(asyncResult);
     }
     finally
     {
         Thread.MemoryBarrier();
         ((ManualResetEvent)asyncResult.AsyncWaitHandle).Set();
     }
 }
 internal void SetResult(MappingPropertyBag bag, MappingResultState resultState)
 {
     _resultState = resultState;
     _bag = bag;
 }
 /// <summary>
 /// Compares a <see cref="MappingResultState">MappingResultState</see> obj for value equality.
 /// </summary>
 /// <param name="obj"><see cref="MappingResultState">MappingResultState</see> to compare.</param>
 /// <returns>True if obj is equal to this instance, false otherwise.</returns>
 public bool Equals(MappingResultState obj)
 {
     return obj._hResult == this._hResult;
 }
 internal void SetResult(MappingPropertyBag bag, MappingResultState resultState)
 {
     _resultState = resultState;
     _bag         = bag;
 }
Beispiel #8
0
 /// <summary>Compares a <see cref="MappingResultState">MappingResultState</see> obj for value equality.</summary>
 /// <param name="obj"><see cref="MappingResultState">MappingResultState</see> to compare.</param>
 /// <returns>True if obj is equal to this instance, false otherwise.</returns>
 public bool Equals(MappingResultState obj) => obj._hResult == _hResult;
 /// <summary>
 /// Compares a <see cref="MappingResultState">MappingResultState</see> obj for value equality.
 /// </summary>
 /// <param name="obj"><see cref="MappingResultState">MappingResultState</see> to compare.</param>
 /// <returns>True if obj is equal to this instance, false otherwise.</returns>
 public bool Equals(MappingResultState obj)
 {
     return(obj._hResult == this._hResult);
 }