Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CompMod / System / ComponentModel / AsyncCompletedEventArgs.cs / 1 / AsyncCompletedEventArgs.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel { using System.Diagnostics.CodeAnalysis; using System.Security.Permissions; using System.Reflection; [HostProtection(SharedState = true)] public class AsyncCompletedEventArgs : System.EventArgs { private readonly Exception error; private readonly bool cancelled; private readonly object userState; public AsyncCompletedEventArgs(Exception error, bool cancelled, object userState) { this.error = error; this.cancelled = cancelled; this.userState = userState; } [ SRDescription(SR.Async_AsyncEventArgs_Cancelled) ] public bool Cancelled { get { return cancelled; } } [ SRDescription(SR.Async_AsyncEventArgs_Error) ] public Exception Error { get { return error; } } [ SRDescription(SR.Async_AsyncEventArgs_UserState) ] public object UserState { get { return userState; } } // Call from every result 'getter'. Will throw if there's an error or operation was cancelled // [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] protected void RaiseExceptionIfNecessary() { if (Error != null) { throw new TargetInvocationException(SR.GetString(SR.Async_ExceptionOccurred), Error); } else if (Cancelled) { throw new InvalidOperationException(SR.GetString(SR.Async_OperationCancelled)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel { using System.Diagnostics.CodeAnalysis; using System.Security.Permissions; using System.Reflection; [HostProtection(SharedState = true)] public class AsyncCompletedEventArgs : System.EventArgs { private readonly Exception error; private readonly bool cancelled; private readonly object userState; public AsyncCompletedEventArgs(Exception error, bool cancelled, object userState) { this.error = error; this.cancelled = cancelled; this.userState = userState; } [ SRDescription(SR.Async_AsyncEventArgs_Cancelled) ] public bool Cancelled { get { return cancelled; } } [ SRDescription(SR.Async_AsyncEventArgs_Error) ] public Exception Error { get { return error; } } [ SRDescription(SR.Async_AsyncEventArgs_UserState) ] public object UserState { get { return userState; } } // Call from every result 'getter'. Will throw if there's an error or operation was cancelled // [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] protected void RaiseExceptionIfNecessary() { if (Error != null) { throw new TargetInvocationException(SR.GetString(SR.Async_ExceptionOccurred), Error); } else if (Cancelled) { throw new InvalidOperationException(SR.GetString(SR.Async_OperationCancelled)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SplayTreeNode.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- Application.cs
- SetUserPreferenceRequest.cs
- HtmlLink.cs
- Permission.cs
- ErrorFormatterPage.cs
- WorkflowCompensationBehavior.cs
- CodeArrayIndexerExpression.cs
- FigureHelper.cs
- ErrorFormatter.cs
- Random.cs
- DoubleAnimationUsingKeyFrames.cs
- InstanceData.cs
- EventSetter.cs
- RSAOAEPKeyExchangeDeformatter.cs
- LoginName.cs
- DocumentViewer.cs
- TextFragmentEngine.cs
- HyperLinkColumn.cs
- ConfigXmlComment.cs
- VersionValidator.cs
- StyleBamlTreeBuilder.cs
- GuidelineCollection.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- controlskin.cs
- WindowsListBox.cs
- ProfileBuildProvider.cs
- DNS.cs
- MaterialGroup.cs
- StandardOleMarshalObject.cs
- NGCSerializationManagerAsync.cs
- MimeFormatter.cs
- TabControlEvent.cs
- CqlGenerator.cs
- DelegateOutArgument.cs
- EntityContainerEntitySet.cs
- HealthMonitoringSectionHelper.cs
- MonitoringDescriptionAttribute.cs
- BindingValueChangedEventArgs.cs
- VisualSerializer.cs
- AQNBuilder.cs
- CryptoHelper.cs
- ApplyTemplatesAction.cs
- FormViewUpdateEventArgs.cs
- OpenFileDialog.cs
- StringFreezingAttribute.cs
- StoreAnnotationsMap.cs
- EntityCollection.cs
- TextViewBase.cs
- FontFaceLayoutInfo.cs
- GeneralTransform3DGroup.cs
- Maps.cs
- ResourceCategoryAttribute.cs
- UniqueEventHelper.cs
- SerializationStore.cs
- ButtonPopupAdapter.cs
- ExpressionEditorAttribute.cs
- TreeViewItem.cs
- CmsInterop.cs
- EndPoint.cs
- InfoCardClaim.cs
- XmlAttributeProperties.cs
- CodeGenerationManager.cs
- DrawingContextWalker.cs
- SoapEnvelopeProcessingElement.cs
- EntityDataSourceViewSchema.cs
- SoapWriter.cs
- ProfilePropertySettingsCollection.cs
- DoubleIndependentAnimationStorage.cs
- DrawItemEvent.cs
- VariableQuery.cs
- DataGridViewColumnEventArgs.cs
- UdpConstants.cs
- EncoderParameters.cs
- PointCollection.cs
- VolatileEnlistmentMultiplexing.cs
- OperandQuery.cs
- MatchNoneMessageFilter.cs
- Visual.cs
- MsmqChannelFactory.cs
- Image.cs
- PageAsyncTaskManager.cs
- SingleAnimationUsingKeyFrames.cs
- SqlColumnizer.cs
- VectorKeyFrameCollection.cs
- SiteIdentityPermission.cs
- Screen.cs
- GACIdentityPermission.cs
- TableRowCollection.cs
- AnnotationAuthorChangedEventArgs.cs
- WebContext.cs
- ComEventsHelper.cs
- JsonObjectDataContract.cs
- RemoteArgument.cs
- TextRangeSerialization.cs
- OleAutBinder.cs
- DeflateStream.cs
- LongValidator.cs
- EmbeddedMailObject.cs