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
- HttpCachePolicyElement.cs
- AmbientLight.cs
- ContextItemManager.cs
- ListViewHitTestInfo.cs
- ModelFactory.cs
- AutomationPatternInfo.cs
- IconBitmapDecoder.cs
- ScrollPattern.cs
- MemoryMappedFile.cs
- BuildProviderCollection.cs
- OrderedDictionaryStateHelper.cs
- SimplePropertyEntry.cs
- ListBindableAttribute.cs
- OpCopier.cs
- SrgsToken.cs
- COAUTHIDENTITY.cs
- KeyEventArgs.cs
- HttpCacheVary.cs
- FieldNameLookup.cs
- EntityChangedParams.cs
- RepeatButtonAutomationPeer.cs
- SchemaTableOptionalColumn.cs
- DateTimeParse.cs
- HttpRequest.cs
- AuthenticationConfig.cs
- DateTimeFormatInfoScanner.cs
- ResourcesBuildProvider.cs
- input.cs
- XmlAttribute.cs
- HtmlForm.cs
- PropertyMetadata.cs
- Fonts.cs
- BindingList.cs
- ControlParameter.cs
- BackgroundWorker.cs
- WebPart.cs
- HttpModuleActionCollection.cs
- BaseTemplatedMobileComponentEditor.cs
- basecomparevalidator.cs
- TakeQueryOptionExpression.cs
- TransformerConfigurationWizardBase.cs
- DeviceFiltersSection.cs
- ProfilePropertySettings.cs
- UserMapPath.cs
- LinearGradientBrush.cs
- PersonalizationEntry.cs
- XamlReader.cs
- Exceptions.cs
- ConfigurationFileMap.cs
- UnsafeNativeMethods.cs
- XmlSerializableServices.cs
- MemoryFailPoint.cs
- Privilege.cs
- Compiler.cs
- ConfigurationLocationCollection.cs
- InvalidStoreProtectionKeyException.cs
- DataBoundControl.cs
- DrawingGroup.cs
- MULTI_QI.cs
- MouseButton.cs
- ThrowHelper.cs
- ResXResourceSet.cs
- DataObject.cs
- AdapterDictionary.cs
- ProgressPage.cs
- ApplicationSettingsBase.cs
- TTSEngineTypes.cs
- ConfigurationPropertyAttribute.cs
- VirtualDirectoryMappingCollection.cs
- ObjectQuery.cs
- RenameRuleObjectDialog.Designer.cs
- FigureParagraph.cs
- loginstatus.cs
- PropertyChangedEventManager.cs
- SiteMembershipCondition.cs
- QueryOperator.cs
- Validator.cs
- CodeDomLoader.cs
- ZipIOExtraField.cs
- TextServicesCompartment.cs
- SpellerHighlightLayer.cs
- DrawListViewSubItemEventArgs.cs
- XmlDeclaration.cs
- TdsValueSetter.cs
- XmlJsonReader.cs
- DataBindingHandlerAttribute.cs
- WindowsListViewGroup.cs
- EntityTransaction.cs
- GridLength.cs
- IBuiltInEvidence.cs
- TextLine.cs
- SqlDataSourceSelectingEventArgs.cs
- DistributedTransactionPermission.cs
- PropertyMetadata.cs
- XmlSchemaAttributeGroup.cs
- Point4D.cs
- XPathNavigatorKeyComparer.cs
- SelectionGlyph.cs
- CodeNamespace.cs
- StructuredTypeInfo.cs