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
- ITextView.cs
- NonParentingControl.cs
- MemberProjectionIndex.cs
- TypeListConverter.cs
- DataGridPagerStyle.cs
- DataGridViewLinkColumn.cs
- ReflectEventDescriptor.cs
- CopyOnWriteList.cs
- CqlWriter.cs
- PointCollectionValueSerializer.cs
- KnownTypes.cs
- NativeWindow.cs
- CompilerInfo.cs
- ColumnBinding.cs
- AsyncPostBackTrigger.cs
- InfoCardProofToken.cs
- SettingsPropertyNotFoundException.cs
- StylusEventArgs.cs
- Models.cs
- CloudCollection.cs
- XPathMultyIterator.cs
- WebEventTraceProvider.cs
- ValidationContext.cs
- XmlSchemaAttribute.cs
- ListViewContainer.cs
- LinkLabelLinkClickedEvent.cs
- ExtensibleClassFactory.cs
- AjaxFrameworkAssemblyAttribute.cs
- Stackframe.cs
- Atom10FeedFormatter.cs
- thaishape.cs
- MsmqIntegrationBindingCollectionElement.cs
- UICuesEvent.cs
- InputScopeConverter.cs
- ExpressionBindings.cs
- NativeCompoundFileAPIs.cs
- ArraySortHelper.cs
- FileDialog.cs
- ControlSerializer.cs
- RelationshipConverter.cs
- ArrangedElement.cs
- NonNullItemCollection.cs
- PriorityBinding.cs
- Literal.cs
- XmlMtomWriter.cs
- PersonalizationProviderHelper.cs
- ServerValidateEventArgs.cs
- CharUnicodeInfo.cs
- XmlDocumentFieldSchema.cs
- HashLookup.cs
- EdmError.cs
- HttpResponseHeader.cs
- DbConvert.cs
- SourceChangedEventArgs.cs
- BaseResourcesBuildProvider.cs
- MemberJoinTreeNode.cs
- SurrogateEncoder.cs
- UnsafeNativeMethods.cs
- ExtensibleClassFactory.cs
- ToolStripPanelRow.cs
- GroupBoxAutomationPeer.cs
- DbDeleteCommandTree.cs
- DataGridViewCheckBoxColumn.cs
- EntityContainerEntitySet.cs
- SqlDeflator.cs
- TiffBitmapDecoder.cs
- CommandDesigner.cs
- EmptyStringExpandableObjectConverter.cs
- IdentityNotMappedException.cs
- COM2Enum.cs
- ImageUrlEditor.cs
- CommentEmitter.cs
- DiscardableAttribute.cs
- DoubleAnimation.cs
- SqlEnums.cs
- ContentType.cs
- AddInAttribute.cs
- DataTransferEventArgs.cs
- COM2PictureConverter.cs
- DbConnectionPoolCounters.cs
- XmlTextEncoder.cs
- PtsContext.cs
- WmpBitmapEncoder.cs
- ObjectDataProvider.cs
- ListView.cs
- RadioButton.cs
- ThicknessAnimationUsingKeyFrames.cs
- DataColumnChangeEvent.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- RequiredFieldValidator.cs
- FlowDecisionLabelFeature.cs
- Message.cs
- NativeMethods.cs
- Console.cs
- DomainUpDown.cs
- formatter.cs
- TemplateDefinition.cs
- ValueHandle.cs
- HelpKeywordAttribute.cs
- GlyphingCache.cs