Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SapiRecognizer.cs
- HtmlInputRadioButton.cs
- Drawing.cs
- RuntimeConfig.cs
- InfoCardKeyedHashAlgorithm.cs
- DataTableNewRowEvent.cs
- _UriTypeConverter.cs
- SqlDataSource.cs
- Timer.cs
- HttpChannelFactory.cs
- CompositeControl.cs
- ToolboxItemCollection.cs
- ToolStripSeparatorRenderEventArgs.cs
- SerTrace.cs
- GlyphingCache.cs
- OperatorExpressions.cs
- ProfessionalColors.cs
- SafeProcessHandle.cs
- UnaryNode.cs
- SerializationException.cs
- AndMessageFilterTable.cs
- SqlPersonalizationProvider.cs
- WorkBatch.cs
- ItemCollectionEditor.cs
- AttributeAction.cs
- XmlChildNodes.cs
- CompoundFileReference.cs
- _HeaderInfo.cs
- FormatterServicesNoSerializableCheck.cs
- HttpProfileBase.cs
- HostnameComparisonMode.cs
- EntityDataSourceWrapper.cs
- InvalidAsynchronousStateException.cs
- HttpProfileBase.cs
- TextParaLineResult.cs
- WSFederationHttpBinding.cs
- MarkerProperties.cs
- MailMessage.cs
- Helpers.cs
- CustomAttributeBuilder.cs
- ResourceAssociationSet.cs
- entitydatasourceentitysetnameconverter.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- TraceUtility.cs
- HitTestResult.cs
- WebControlParameterProxy.cs
- TextSpanModifier.cs
- Header.cs
- StrokeCollectionDefaultValueFactory.cs
- MetadataAssemblyHelper.cs
- HttpWebRequest.cs
- Rect3DValueSerializer.cs
- BufferBuilder.cs
- OperandQuery.cs
- Select.cs
- MediaTimeline.cs
- EncoderBestFitFallback.cs
- _AcceptOverlappedAsyncResult.cs
- Empty.cs
- DecoderFallback.cs
- TextSchema.cs
- ZipIOCentralDirectoryBlock.cs
- OperatingSystem.cs
- ZoneMembershipCondition.cs
- WebConfigurationManager.cs
- PageThemeCodeDomTreeGenerator.cs
- SSmlParser.cs
- VirtualPathProvider.cs
- OutputCache.cs
- Thickness.cs
- ModulesEntry.cs
- DataConnectionHelper.cs
- SQLInt16Storage.cs
- EncodingTable.cs
- TextEmbeddedObject.cs
- DataErrorValidationRule.cs
- TemplateLookupAction.cs
- SessionState.cs
- BufferedWebEventProvider.cs
- EntityWithKeyStrategy.cs
- TextEditorSpelling.cs
- RootDesignerSerializerAttribute.cs
- UIElement3D.cs
- DocumentOrderComparer.cs
- UxThemeWrapper.cs
- _WebProxyDataBuilder.cs
- HierarchicalDataTemplate.cs
- DNS.cs
- AffineTransform3D.cs
- Configuration.cs
- EnumType.cs
- SettingsPropertyValueCollection.cs
- VectorCollectionValueSerializer.cs
- CacheSection.cs
- Bold.cs
- ParameterCollection.cs
- NativeMethods.cs
- DbConnectionInternal.cs
- SuspendDesigner.cs
- ICspAsymmetricAlgorithm.cs