Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- OleDbTransaction.cs
- XmlSecureResolver.cs
- DeferredElementTreeState.cs
- SchemaLookupTable.cs
- ContractUtils.cs
- HeaderedContentControl.cs
- XmlEventCache.cs
- BuildManager.cs
- DbMetaDataCollectionNames.cs
- MissingManifestResourceException.cs
- NullableConverter.cs
- XPathQilFactory.cs
- X509LogoTypeExtension.cs
- PixelShader.cs
- BrowserCapabilitiesFactoryBase.cs
- ByteArrayHelperWithString.cs
- StateElement.cs
- XsdValidatingReader.cs
- MobileControlsSection.cs
- GatewayIPAddressInformationCollection.cs
- DataGridViewColumnEventArgs.cs
- XmlQueryTypeFactory.cs
- SafeArchiveContext.cs
- DiffuseMaterial.cs
- ResourceAssociationType.cs
- ParserStack.cs
- AsyncContentLoadedEventArgs.cs
- OrthographicCamera.cs
- ExplicitDiscriminatorMap.cs
- CodeIdentifiers.cs
- LinkArea.cs
- SpellerHighlightLayer.cs
- Errors.cs
- LingerOption.cs
- entitydatasourceentitysetnameconverter.cs
- LinkedResourceCollection.cs
- ScrollChrome.cs
- Html32TextWriter.cs
- HtmlElementCollection.cs
- AttributeSetAction.cs
- HwndProxyElementProvider.cs
- Ipv6Element.cs
- SendActivityDesignerTheme.cs
- PasswordDeriveBytes.cs
- SerializerWriterEventHandlers.cs
- PerformanceCounterPermissionAttribute.cs
- keycontainerpermission.cs
- GeneratedContractType.cs
- EdmValidator.cs
- storepermission.cs
- _ListenerResponseStream.cs
- _AuthenticationState.cs
- bidPrivateBase.cs
- ThreadStateException.cs
- CryptoHelper.cs
- DefaultPropertyAttribute.cs
- HtmlDocument.cs
- Translator.cs
- ProcessModelInfo.cs
- ISCIIEncoding.cs
- Decimal.cs
- GridViewColumn.cs
- SplineQuaternionKeyFrame.cs
- ToolStripItemTextRenderEventArgs.cs
- WindowsStartMenu.cs
- LazyTextWriterCreator.cs
- ConditionCollection.cs
- HttpRequestCacheValidator.cs
- DataGridAddNewRow.cs
- BuilderPropertyEntry.cs
- DocumentViewerConstants.cs
- ICspAsymmetricAlgorithm.cs
- WebPartConnectVerb.cs
- LayoutUtils.cs
- ModelUIElement3D.cs
- BitConverter.cs
- ElementHostAutomationPeer.cs
- HostExecutionContextManager.cs
- FormView.cs
- QilExpression.cs
- ConfigurationManager.cs
- Transform3D.cs
- ServiceModelConfigurationSectionGroup.cs
- PrePostDescendentsWalker.cs
- ByValueEqualityComparer.cs
- SplineQuaternionKeyFrame.cs
- ChannelManager.cs
- CodeCatchClause.cs
- InitializationEventAttribute.cs
- DetailsView.cs
- InheritedPropertyChangedEventArgs.cs
- PropertyDescriptor.cs
- ErrorRuntimeConfig.cs
- SerializationInfo.cs
- QueuePathDialog.cs
- ITextView.cs
- Directory.cs
- XmlSchemaComplexContentExtension.cs
- TextControlDesigner.cs
- ClientOperationFormatterProvider.cs