Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- MessageSecurityVersionConverter.cs
- AnimatedTypeHelpers.cs
- WebPartConnectionCollection.cs
- UnsafePeerToPeerMethods.cs
- SoapIncludeAttribute.cs
- ParameterElementCollection.cs
- ListBoxChrome.cs
- Error.cs
- ImageAnimator.cs
- Keyboard.cs
- SymLanguageType.cs
- RubberbandSelector.cs
- LinqDataSourceDeleteEventArgs.cs
- SspiNegotiationTokenProviderState.cs
- OleDbError.cs
- StringAttributeCollection.cs
- TextOutput.cs
- IDispatchConstantAttribute.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- ByteAnimation.cs
- AppSettingsExpressionEditor.cs
- FormsAuthentication.cs
- FloatMinMaxAggregationOperator.cs
- HtmlFormParameterWriter.cs
- DesignColumn.cs
- InvalidOperationException.cs
- ExpandSegmentCollection.cs
- ViewUtilities.cs
- EtwTrace.cs
- ChannelCredentials.cs
- StaticTextPointer.cs
- WebPartCancelEventArgs.cs
- URL.cs
- WebPartVerb.cs
- StateMachineDesignerPaint.cs
- User.cs
- SmtpException.cs
- AppSettingsReader.cs
- Visual3DCollection.cs
- Calendar.cs
- XAMLParseException.cs
- ResXResourceReader.cs
- FilteredXmlReader.cs
- XmlIgnoreAttribute.cs
- XPathParser.cs
- ParamArrayAttribute.cs
- SymbolUsageManager.cs
- CodeEntryPointMethod.cs
- CompiledELinqQueryState.cs
- CodeMemberEvent.cs
- StringAnimationUsingKeyFrames.cs
- MarkupCompiler.cs
- ObjectDataSourceEventArgs.cs
- RegisteredArrayDeclaration.cs
- SecurityIdentifierConverter.cs
- MetadataPropertyAttribute.cs
- FloatMinMaxAggregationOperator.cs
- AlgoModule.cs
- StateMachineHelpers.cs
- SimpleBitVector32.cs
- SafeCryptoHandles.cs
- ListViewTableRow.cs
- CanExecuteRoutedEventArgs.cs
- SafeNativeMethodsOther.cs
- ValidationEventArgs.cs
- Compress.cs
- DataObject.cs
- ToolStripOverflow.cs
- FlowLayoutSettings.cs
- TabControlCancelEvent.cs
- fixedPageContentExtractor.cs
- ControlCachePolicy.cs
- BoundPropertyEntry.cs
- ItemsControlAutomationPeer.cs
- XmlImplementation.cs
- IPEndPoint.cs
- PartialToken.cs
- MenuEventArgs.cs
- Operator.cs
- PKCS1MaskGenerationMethod.cs
- SmtpNegotiateAuthenticationModule.cs
- EmptyStringExpandableObjectConverter.cs
- TargetException.cs
- DirectoryNotFoundException.cs
- SectionVisual.cs
- UpdateCompiler.cs
- MouseEventArgs.cs
- SendKeys.cs
- HttpCacheParams.cs
- ConfigDefinitionUpdates.cs
- LinqDataSourceEditData.cs
- Stack.cs
- BezierSegment.cs
- DesignBinding.cs
- ITreeGenerator.cs
- ToolStripDropDownClosedEventArgs.cs
- TextPenaltyModule.cs
- StrongNameKeyPair.cs
- FileFormatException.cs
- HtmlShimManager.cs