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
- Latin1Encoding.cs
- URLIdentityPermission.cs
- FilteredAttributeCollection.cs
- MD5.cs
- HttpProfileBase.cs
- XslException.cs
- SimpleWebHandlerParser.cs
- indexingfiltermarshaler.cs
- Window.cs
- ActivityStatusChangeEventArgs.cs
- ConsumerConnectionPointCollection.cs
- PathGeometry.cs
- BinarySerializer.cs
- XPathParser.cs
- CompiledRegexRunner.cs
- LineServicesCallbacks.cs
- HtmlToClrEventProxy.cs
- DomNameTable.cs
- ConfigurationElementProperty.cs
- QilPatternVisitor.cs
- LoaderAllocator.cs
- RangeBaseAutomationPeer.cs
- StreamInfo.cs
- AsyncDataRequest.cs
- ProcessHostFactoryHelper.cs
- SourceLineInfo.cs
- XmlSchemaElement.cs
- EditorAttribute.cs
- KerberosSecurityTokenProvider.cs
- InvokeGenerator.cs
- ScrollChangedEventArgs.cs
- NonParentingControl.cs
- VirtualPathUtility.cs
- EntityRecordInfo.cs
- ApplicationSettingsBase.cs
- ArrayHelper.cs
- ZipIOExtraFieldPaddingElement.cs
- ConfigurationErrorsException.cs
- UIElement.cs
- WindowsMenu.cs
- DataGridTable.cs
- GcSettings.cs
- SolidColorBrush.cs
- FactoryGenerator.cs
- SystemIPInterfaceStatistics.cs
- ResXBuildProvider.cs
- ProfilePropertySettings.cs
- DesignConnection.cs
- InheritablePropertyChangeInfo.cs
- ExceptionHandlerDesigner.cs
- XmlExceptionHelper.cs
- IDispatchConstantAttribute.cs
- PropertyTab.cs
- EnumValAlphaComparer.cs
- TypefaceMetricsCache.cs
- WorkflowInvoker.cs
- SelectionHighlightInfo.cs
- PropertyCondition.cs
- ResourcePart.cs
- ParserExtension.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- GlobalEventManager.cs
- CommonDialog.cs
- UniqueIdentifierService.cs
- AudioSignalProblemOccurredEventArgs.cs
- DashStyles.cs
- InheritablePropertyChangeInfo.cs
- Roles.cs
- UnknownWrapper.cs
- FormatPage.cs
- SemaphoreSlim.cs
- OdbcDataAdapter.cs
- CodePageEncoding.cs
- UserPrincipalNameElement.cs
- PackageStore.cs
- ContextMenuAutomationPeer.cs
- EndpointInfoCollection.cs
- ColumnWidthChangingEvent.cs
- X509Utils.cs
- SizeValueSerializer.cs
- InputScope.cs
- TabletDevice.cs
- FederatedMessageSecurityOverHttp.cs
- bidPrivateBase.cs
- RedirectionProxy.cs
- tooltip.cs
- HandlerElementCollection.cs
- FeatureManager.cs
- DeviceContext.cs
- Parsers.cs
- ResourceCategoryAttribute.cs
- SQLByte.cs
- HttpListenerRequest.cs
- SQLMembershipProvider.cs
- PartialList.cs
- DockAndAnchorLayout.cs
- StateWorkerRequest.cs
- TextBounds.cs
- QilTypeChecker.cs
- ConstructorBuilder.cs