Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / HttpAsyncResult.cs / 2 / HttpAsyncResult.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * ASP.NET simple internal implementation of IAsyncResult * * Copyright (c) 2000 Microsoft Corporation */ namespace System.Web { using System; using System.Threading; internal class HttpAsyncResult : IAsyncResult { private AsyncCallback _callback; private Object _asyncState; private bool _completed; private bool _completedSynchronously; private Object _result; private Exception _error; // pipeline support private RequestNotificationStatus _status; /* * Constructor with pending result */ internal HttpAsyncResult(AsyncCallback cb, Object state) { _callback = cb; _asyncState = state; _status = RequestNotificationStatus.Continue; } /* * Constructor with known result */ internal HttpAsyncResult(AsyncCallback cb, Object state, bool completed, Object result, Exception error) { _callback = cb; _asyncState = state; _completed = completed; _completedSynchronously = completed; _result = result; _error = error; _status = RequestNotificationStatus.Continue; if (_completed && _callback != null) _callback(this); } internal void SetComplete() { _completed = true; } /* * Helper method to process completions */ internal void Complete(bool synchronous, Object result, Exception error, RequestNotificationStatus status) { _completed = true; _completedSynchronously = synchronous; _result = result; _error = error; _status = status; if (_callback != null) _callback(this); } internal void Complete(bool synchronous, Object result, Exception error) { Complete(synchronous, result, error, RequestNotificationStatus.Continue); } /* * Helper method to implement End call to async method */ internal Object End() { if (_error != null) throw new HttpException(null, _error); return _result; } // // Properties that are not part of IAsyncResult // internal Exception Error { get { return _error;}} internal RequestNotificationStatus Status { get { return _status; } } // // IAsyncResult implementation // public bool IsCompleted { get { return _completed;}} public bool CompletedSynchronously { get { return _completedSynchronously;}} public Object AsyncState { get { return _asyncState;}} public WaitHandle AsyncWaitHandle { get { return null;}} // wait not supported } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PersonalizationDictionary.cs
- MembershipUser.cs
- Control.cs
- GroupBox.cs
- ArglessEventHandlerProxy.cs
- MemoryStream.cs
- Util.cs
- SecUtil.cs
- HotSpotCollection.cs
- DBConnection.cs
- DoWorkEventArgs.cs
- ResourceReader.cs
- HwndAppCommandInputProvider.cs
- UpdateCompiler.cs
- ColumnPropertiesGroup.cs
- DBSchemaRow.cs
- BuildDependencySet.cs
- KeyValueSerializer.cs
- LabelDesigner.cs
- TraceHandler.cs
- OleDbReferenceCollection.cs
- CallSite.cs
- ToolStripContentPanelRenderEventArgs.cs
- WebBaseEventKeyComparer.cs
- AuthenticationConfig.cs
- ValidationHelper.cs
- CustomTokenProvider.cs
- FileLevelControlBuilderAttribute.cs
- DictionaryEntry.cs
- HtmlInputHidden.cs
- FunctionQuery.cs
- MultiDataTrigger.cs
- ShaderRenderModeValidation.cs
- BezierSegment.cs
- StatusBar.cs
- RoleService.cs
- IncrementalHitTester.cs
- WorkflowElementDialogWindow.xaml.cs
- InkCanvasFeedbackAdorner.cs
- Options.cs
- ConnectionConsumerAttribute.cs
- ToolStripSeparator.cs
- TraceHandlerErrorFormatter.cs
- ExchangeUtilities.cs
- MailWriter.cs
- RepeaterCommandEventArgs.cs
- ErrorHandler.cs
- Rfc2898DeriveBytes.cs
- odbcmetadatafactory.cs
- ResolveCompletedEventArgs.cs
- RecordConverter.cs
- HttpCachePolicy.cs
- UserNamePasswordClientCredential.cs
- PersonalizationProviderCollection.cs
- _SslStream.cs
- DataListItem.cs
- ColorTransform.cs
- ClientScriptManagerWrapper.cs
- ArraySortHelper.cs
- StackBuilderSink.cs
- NotCondition.cs
- CustomAttributeFormatException.cs
- XmlSchemaSimpleContentRestriction.cs
- DataBindEngine.cs
- PeerNameRecord.cs
- CompletionCallbackWrapper.cs
- PhysicalOps.cs
- ReaderWriterLock.cs
- DesignerActionVerbList.cs
- ProgressPage.cs
- CroppedBitmap.cs
- CodeCatchClauseCollection.cs
- AppliedDeviceFiltersEditor.cs
- IISMapPath.cs
- ControlPropertyNameConverter.cs
- XmlSortKeyAccumulator.cs
- XamlBuildProvider.cs
- SqlDependency.cs
- KnownTypeDataContractResolver.cs
- DBConnectionString.cs
- AppearanceEditorPart.cs
- HierarchicalDataBoundControl.cs
- PolicyValidationException.cs
- CompositeFontInfo.cs
- WindowsToolbarAsMenu.cs
- GridViewDeletedEventArgs.cs
- TypefaceCollection.cs
- HttpListenerRequest.cs
- RayMeshGeometry3DHitTestResult.cs
- XmlSerializerNamespaces.cs
- TextServicesCompartmentEventSink.cs
- PerfCounters.cs
- SiteOfOriginContainer.cs
- PrivilegeNotHeldException.cs
- PasswordBox.cs
- cryptoapiTransform.cs
- TransformedBitmap.cs
- AsyncCompletedEventArgs.cs
- HotSpotCollection.cs
- ClientEventManager.cs