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
- RelationshipEntry.cs
- AssemblyAssociatedContentFileAttribute.cs
- TransformFinalBlockRequest.cs
- SqlDataSourceEnumerator.cs
- RadioButtonList.cs
- safelink.cs
- ObjectContext.cs
- OpacityConverter.cs
- SafeProcessHandle.cs
- Relationship.cs
- AsymmetricAlgorithm.cs
- ConfigsHelper.cs
- TableRowGroup.cs
- BatchParser.cs
- MDIWindowDialog.cs
- SystemException.cs
- HttpPostProtocolImporter.cs
- dtdvalidator.cs
- DataReaderContainer.cs
- PropertyToken.cs
- mansign.cs
- GeometryDrawing.cs
- GenerateScriptTypeAttribute.cs
- ModelChangedEventArgsImpl.cs
- StyleReferenceConverter.cs
- TypeValidationEventArgs.cs
- CursorConverter.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- SiteIdentityPermission.cs
- FixedElement.cs
- EngineSite.cs
- OleDbException.cs
- StylusTip.cs
- AliasedSlot.cs
- FacetEnabledSchemaElement.cs
- documentsequencetextview.cs
- SiteMapSection.cs
- ListViewCommandEventArgs.cs
- InputGestureCollection.cs
- DesignerAutoFormatCollection.cs
- ConversionValidationRule.cs
- Hashtable.cs
- Drawing.cs
- InstanceHandleReference.cs
- GeometryModel3D.cs
- TextBoxBase.cs
- Scripts.cs
- CallContext.cs
- XmlSchemaInferenceException.cs
- FormViewUpdateEventArgs.cs
- DefaultObjectMappingItemCollection.cs
- BaseTemplateParser.cs
- ListViewAutomationPeer.cs
- SelectorAutomationPeer.cs
- InputBindingCollection.cs
- FileStream.cs
- TextRunProperties.cs
- DefaultProxySection.cs
- RegexGroupCollection.cs
- TreeSet.cs
- CheckBox.cs
- InputManager.cs
- LineMetrics.cs
- TextTreeInsertElementUndoUnit.cs
- SqlDataSourceStatusEventArgs.cs
- DesignerTransaction.cs
- TextPointer.cs
- AuthorizationSection.cs
- SafeRegistryHandle.cs
- ClrPerspective.cs
- DecimalAverageAggregationOperator.cs
- ConstraintCollection.cs
- Queue.cs
- FloaterBaseParagraph.cs
- EventSetter.cs
- BitmapEffectGeneralTransform.cs
- ParserOptions.cs
- NetworkInterface.cs
- Win32Interop.cs
- DriveInfo.cs
- ListControl.cs
- ApplicationTrust.cs
- SelectedGridItemChangedEvent.cs
- StringDictionaryWithComparer.cs
- StackOverflowException.cs
- DocumentXPathNavigator.cs
- OLEDB_Enum.cs
- EntityPropertyMappingAttribute.cs
- XmlCustomFormatter.cs
- FontFamily.cs
- RestHandler.cs
- CodeTypeReferenceCollection.cs
- DataGridViewButtonCell.cs
- BufferedGraphicsContext.cs
- BCryptSafeHandles.cs
- GetPageCompletedEventArgs.cs
- GrammarBuilder.cs
- FamilyCollection.cs
- GroupByExpressionRewriter.cs
- DesignerLinkAdapter.cs