Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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));
}
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ErrorStyle.cs
- UDPClient.cs
- SecuritySessionSecurityTokenProvider.cs
- HttpStreamXmlDictionaryReader.cs
- WebBrowserBase.cs
- WorkflowClientDeliverMessageWrapper.cs
- Page.cs
- StringUtil.cs
- StringFreezingAttribute.cs
- ResponseStream.cs
- FactoryGenerator.cs
- __Error.cs
- GestureRecognitionResult.cs
- DetailsViewDeletedEventArgs.cs
- WindowsNonControl.cs
- BrowserCapabilitiesFactoryBase.cs
- TypeEnumerableViewSchema.cs
- LeafCellTreeNode.cs
- OneOfElement.cs
- InstanceContextMode.cs
- CapabilitiesSection.cs
- RuleConditionDialog.Designer.cs
- MetadataFile.cs
- CancellationState.cs
- UndoManager.cs
- EventItfInfo.cs
- AudioLevelUpdatedEventArgs.cs
- Parser.cs
- ToolStripSeparator.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- CodeTypeOfExpression.cs
- DispatcherFrame.cs
- MetabaseServerConfig.cs
- IProducerConsumerCollection.cs
- HostedHttpContext.cs
- WindowAutomationPeer.cs
- _LazyAsyncResult.cs
- dsa.cs
- PolicyManager.cs
- DataContractSerializerOperationFormatter.cs
- PropertyGeneratedEventArgs.cs
- StringResourceManager.cs
- ExtensibleClassFactory.cs
- ZipIOLocalFileBlock.cs
- DateTimeValueSerializerContext.cs
- XmlDsigSep2000.cs
- RemotingServices.cs
- SqlServer2KCompatibilityAnnotation.cs
- XmlReaderSettings.cs
- CodeDelegateInvokeExpression.cs
- SecurityContextSecurityTokenParameters.cs
- OletxCommittableTransaction.cs
- UrlMappingsModule.cs
- GC.cs
- _NegoState.cs
- PowerModeChangedEventArgs.cs
- XmlWriterTraceListener.cs
- PrintingPermissionAttribute.cs
- CssTextWriter.cs
- Vector3DValueSerializer.cs
- ExtendedPropertyDescriptor.cs
- XmlDataLoader.cs
- SrgsGrammarCompiler.cs
- BitmapImage.cs
- EndpointDiscoveryMetadata11.cs
- SmtpDateTime.cs
- CompiledIdentityConstraint.cs
- _IPv6Address.cs
- RequestCacheEntry.cs
- RealizedColumnsBlock.cs
- DataGridLinkButton.cs
- TextElementEnumerator.cs
- DataBoundControl.cs
- Knowncolors.cs
- ArraySortHelper.cs
- XamlVector3DCollectionSerializer.cs
- FocusTracker.cs
- GridViewColumn.cs
- WindowsListBox.cs
- CreateUserErrorEventArgs.cs
- Schema.cs
- AuthorizationSection.cs
- __FastResourceComparer.cs
- HtmlEncodedRawTextWriter.cs
- ListenerElementsCollection.cs
- PropertyDescriptorCollection.cs
- GlobalAllocSafeHandle.cs
- MetadataItemCollectionFactory.cs
- QueryCacheKey.cs
- GenericTextProperties.cs
- ExpressionEditor.cs
- ContentPosition.cs
- InvalidEnumArgumentException.cs
- HtmlUtf8RawTextWriter.cs
- TextEvent.cs
- ChangeBlockUndoRecord.cs
- UrlAuthFailureHandler.cs
- LocatorPart.cs
- TreeNodeCollection.cs
- DesignerActionVerbList.cs