private void queueableBeginQuery(Object asyncResult) { AsyncResult <IFeatureDataReader> typedAsyncResult = asyncResult as AsyncResult <IFeatureDataReader>; Assert.IsNotNull(typedAsyncResult); FeatureQueryExpression query = typedAsyncResult.AsyncState as FeatureQueryExpression; if (query == null) { SpatialBinaryExpression spatialBinaryExpression = typedAsyncResult.AsyncState as SpatialBinaryExpression; if (spatialBinaryExpression != null) { query = new FeatureQueryExpression(new AllAttributesExpression(), spatialBinaryExpression, query.Sort); } } try { typedAsyncResult.SetComplete(InnerFeatureProvider.ExecuteFeatureQuery(query), false); } catch (Exception terminatingException) { typedAsyncResult.SetComplete(false, terminatingException); } }
private void QueueableBeginQuery(Object asyncResult) { AsyncResult <Stream> typedAsyncResult = asyncResult as AsyncResult <Stream>; RasterQueryExpression query = typedAsyncResult.AsyncState as RasterQueryExpression; try { typedAsyncResult.SetComplete(InnerRasterProvider.ExecuteRasterQuery(query), false); } catch (Exception terminatingException) { typedAsyncResult.SetComplete(false, terminatingException); } }
public void Completed() { AsyncResult ar = new AsyncResult(null, this); ar.SetComplete(); Assert.True(ar.IsCompleted); }
public void CompletedSynchronouslyProperty() { AsyncResult ar = new AsyncResult(null, this); ar.SetComplete(true, null); Assert.True(ar.IsCompleted); Assert.True(ar.CompletedSynchronously); }
public void CallBack() { CallBackHelper callBackRecorder = new CallBackHelper(); AsyncResult ar = new AsyncResult(callBackRecorder.CallBack, this); ar.SetComplete(); Assert.Same(ar, callBackRecorder.Result); }
public virtual IAsyncResult BeginDoTask(AsyncCallback callback, Object state) { AsyncResult ar = new AsyncResult(callback, state); if (_wait > 0) { ThreadPool.QueueUserWorkItem(QueueableDoTask, ar); } else { ar.SetComplete(true, _terminatingException); } return ar; }