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
- IODescriptionAttribute.cs
- BulletedListEventArgs.cs
- MethodRental.cs
- CommandCollectionEditor.cs
- ClientSettingsProvider.cs
- PlanCompilerUtil.cs
- HitTestParameters.cs
- RectAnimationClockResource.cs
- TcpTransportSecurity.cs
- DataIdProcessor.cs
- Byte.cs
- Debugger.cs
- ActivationWorker.cs
- _emptywebproxy.cs
- TimeEnumHelper.cs
- FrameworkElement.cs
- SettingsPropertyCollection.cs
- CollectionMarkupSerializer.cs
- DBSchemaTable.cs
- QilXmlWriter.cs
- Variable.cs
- LinqToSqlWrapper.cs
- TreeNodeEventArgs.cs
- Soap.cs
- SiteOfOriginPart.cs
- XmlProcessingInstruction.cs
- RunInstallerAttribute.cs
- ConfigXmlComment.cs
- XmlCustomFormatter.cs
- BamlLocalizableResourceKey.cs
- VisemeEventArgs.cs
- ParallelTimeline.cs
- BindStream.cs
- Rotation3DAnimation.cs
- PrintPreviewControl.cs
- SessionMode.cs
- WinInetCache.cs
- SqlCacheDependencyDatabase.cs
- PageAsyncTaskManager.cs
- DLinqDataModelProvider.cs
- DataGridViewDataErrorEventArgs.cs
- Shape.cs
- ActivityCodeDomSerializationManager.cs
- SafeHGlobalHandleCritical.cs
- PropertyManager.cs
- X509CertificateCollection.cs
- CapabilitiesState.cs
- WebEvents.cs
- GridViewSortEventArgs.cs
- BrushValueSerializer.cs
- Wizard.cs
- RichTextBoxDesigner.cs
- DataGridViewColumnConverter.cs
- Int32Rect.cs
- XamlGridLengthSerializer.cs
- filewebrequest.cs
- SessionParameter.cs
- UrlParameterReader.cs
- OdbcConnectionStringbuilder.cs
- RegexRunnerFactory.cs
- DirectionalLight.cs
- FlatButtonAppearance.cs
- XmlSchemaImporter.cs
- ParsedAttributeCollection.cs
- XamlBuildTaskServices.cs
- Stackframe.cs
- ImageFormat.cs
- FileUtil.cs
- _FixedSizeReader.cs
- DbCommandDefinition.cs
- SafeRegistryHandle.cs
- UriSection.cs
- ToolStripItemTextRenderEventArgs.cs
- LookupNode.cs
- InputChannelAcceptor.cs
- BezierSegment.cs
- ChangeNode.cs
- SystemIPInterfaceProperties.cs
- X509ChainElement.cs
- KeyNotFoundException.cs
- altserialization.cs
- StreamResourceInfo.cs
- UnmanagedMemoryStreamWrapper.cs
- ExpandCollapsePattern.cs
- MultiBinding.cs
- ActivityExecutionWorkItem.cs
- IisTraceListener.cs
- RadioButtonFlatAdapter.cs
- future.cs
- DetailsView.cs
- Registration.cs
- Rotation3DAnimationBase.cs
- ValidationPropertyAttribute.cs
- XmlAttributes.cs
- DeploymentSectionCache.cs
- RowUpdatingEventArgs.cs
- PolicyStatement.cs
- ColorBlend.cs
- SaveLedgerEntryRequest.cs
- SqlDataReaderSmi.cs