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
- SqlServer2KCompatibilityCheck.cs
- QuaternionValueSerializer.cs
- GridViewRowCollection.cs
- AcceptorSessionSymmetricTransportSecurityProtocol.cs
- ParagraphVisual.cs
- BuildProviderCollection.cs
- Listener.cs
- PeerTransportListenAddressConverter.cs
- ProbeMatchesMessageCD1.cs
- WCFBuildProvider.cs
- CollectionsUtil.cs
- UIElementParaClient.cs
- TextRangeProviderWrapper.cs
- PointValueSerializer.cs
- TableLayoutPanel.cs
- ObjectResult.cs
- HttpPostServerProtocol.cs
- DataGridAddNewRow.cs
- Binding.cs
- HtmlInputCheckBox.cs
- ThumbButtonInfo.cs
- ExtensionFile.cs
- TextElementEnumerator.cs
- LocalBuilder.cs
- DiagnosticStrings.cs
- TextProperties.cs
- ConfigXmlCDataSection.cs
- RightsManagementEncryptionTransform.cs
- IconBitmapDecoder.cs
- MissingMemberException.cs
- FrameworkContentElement.cs
- HtmlWindowCollection.cs
- CollectionBuilder.cs
- SctClaimSerializer.cs
- RegistryExceptionHelper.cs
- RootDesignerSerializerAttribute.cs
- PreservationFileWriter.cs
- JapaneseLunisolarCalendar.cs
- DataServiceProcessingPipelineEventArgs.cs
- PointValueSerializer.cs
- OutputCacheProfileCollection.cs
- WindowManager.cs
- PipeConnection.cs
- NamespaceInfo.cs
- ExpressionBindings.cs
- GlyphTypeface.cs
- PageThemeBuildProvider.cs
- AssemblyNameProxy.cs
- SelectionItemProviderWrapper.cs
- AnchoredBlock.cs
- ImpersonationContext.cs
- CorrelationKey.cs
- AnnotationHighlightLayer.cs
- TempFiles.cs
- Error.cs
- SR.Designer.cs
- HttpHandlersSection.cs
- RegistryPermission.cs
- MenuItemStyle.cs
- EditorZone.cs
- UriExt.cs
- EntityContainerEmitter.cs
- HitTestFilterBehavior.cs
- WebPartConnectionCollection.cs
- _PooledStream.cs
- DataServiceEntityAttribute.cs
- XamlSerializerUtil.cs
- unitconverter.cs
- PngBitmapDecoder.cs
- DataTemplateKey.cs
- SmtpLoginAuthenticationModule.cs
- DiscriminatorMap.cs
- Comparer.cs
- ReleaseInstanceMode.cs
- StorageEntityTypeMapping.cs
- TagMapInfo.cs
- AstNode.cs
- RedirectionProxy.cs
- SystemResourceHost.cs
- TemplatePartAttribute.cs
- DbTransaction.cs
- InkPresenter.cs
- ObjectDataSourceView.cs
- BooleanExpr.cs
- SEHException.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- DataGridViewRowPrePaintEventArgs.cs
- DelegatedStream.cs
- PageContent.cs
- HTTPNotFoundHandler.cs
- StreamingContext.cs
- SamlAuthenticationStatement.cs
- BinaryFormatter.cs
- BrowserCapabilitiesFactory.cs
- InvokePattern.cs
- SafeHGlobalHandleCritical.cs
- DriveNotFoundException.cs
- StatusBar.cs
- ADMembershipProvider.cs
- NotifyParentPropertyAttribute.cs