Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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)); } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FilterEventArgs.cs
- EditorZoneBase.cs
- SimplePropertyEntry.cs
- Command.cs
- CommandDevice.cs
- HandlerBase.cs
- FixedSOMTableRow.cs
- DocumentGridPage.cs
- MethodRental.cs
- TypeContext.cs
- SystemKeyConverter.cs
- ConfigurationPropertyCollection.cs
- TableCell.cs
- webproxy.cs
- AccessibleObject.cs
- CompositionAdorner.cs
- SplitterCancelEvent.cs
- RTTrackingProfile.cs
- MouseOverProperty.cs
- PermissionSet.cs
- LogSwitch.cs
- AdornerPresentationContext.cs
- DataGridViewCellStyleConverter.cs
- FixedDocumentPaginator.cs
- MaskInputRejectedEventArgs.cs
- SafeNativeMethods.cs
- AuthenticationModuleElementCollection.cs
- DataGridViewUtilities.cs
- XmlSchemaChoice.cs
- JsonWriterDelegator.cs
- ClassHandlersStore.cs
- SafeUserTokenHandle.cs
- BindingBase.cs
- HttpProfileGroupBase.cs
- BuildDependencySet.cs
- TrustLevelCollection.cs
- CodeDomConfigurationHandler.cs
- TextLineBreak.cs
- LicenseManager.cs
- DataSourceControl.cs
- ConnectionPoint.cs
- ArcSegment.cs
- AsyncResult.cs
- DesignerLabelAdapter.cs
- WindowsEditBox.cs
- ResourceBinder.cs
- PersistenceTypeAttribute.cs
- WrappedOptions.cs
- ParseChildrenAsPropertiesAttribute.cs
- MultiDataTrigger.cs
- HttpCookieCollection.cs
- XPathQilFactory.cs
- MouseBinding.cs
- SqlInternalConnection.cs
- SafeNativeMemoryHandle.cs
- ExtendedPropertyCollection.cs
- SerializationStore.cs
- FormatConvertedBitmap.cs
- AbsoluteQuery.cs
- Random.cs
- CustomAttributeBuilder.cs
- DoWorkEventArgs.cs
- BamlLocalizableResourceKey.cs
- InternalCache.cs
- WorkflowDataContext.cs
- XPathAncestorIterator.cs
- ByteBufferPool.cs
- DbConnectionStringCommon.cs
- AssemblySettingAttributes.cs
- DataObjectEventArgs.cs
- ContourSegment.cs
- Crc32.cs
- OpenTypeMethods.cs
- ValueTypePropertyReference.cs
- TextTreeTextElementNode.cs
- MemberMaps.cs
- MutexSecurity.cs
- Lease.cs
- KeySplineConverter.cs
- WindowsSlider.cs
- EventOpcode.cs
- DecimalStorage.cs
- TopClause.cs
- MetadataItemEmitter.cs
- DynamicRendererThreadManager.cs
- HScrollProperties.cs
- Int16AnimationUsingKeyFrames.cs
- EntityDataSourceWrapperCollection.cs
- WriteTimeStream.cs
- DependencyPropertyHelper.cs
- SyntaxCheck.cs
- WindowsClaimSet.cs
- DataViewSetting.cs
- PeerConnector.cs
- Config.cs
- TreeViewEvent.cs
- QilInvokeEarlyBound.cs
- ApplicationException.cs
- CompositeFontParser.cs
- ArrayConverter.cs