Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / AsyncCompletedEventArgs.cs / 1305376 / 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
- DataGridViewRowStateChangedEventArgs.cs
- SmtpAuthenticationManager.cs
- XPathBuilder.cs
- ValidationError.cs
- ExclusiveHandleList.cs
- WorkflowWebHostingModule.cs
- GridItemCollection.cs
- CompoundFileIOPermission.cs
- MDIClient.cs
- SHA384Managed.cs
- AttributeQuery.cs
- MessageQueueCriteria.cs
- ViewManager.cs
- TreeNodeCollection.cs
- TextEditorDragDrop.cs
- XmlSequenceWriter.cs
- SQLBinary.cs
- AssemblyAttributes.cs
- DataGridViewImageCell.cs
- TreeWalker.cs
- FileVersionInfo.cs
- CommandID.cs
- PagerSettings.cs
- FormViewUpdatedEventArgs.cs
- TriState.cs
- XPathNodeInfoAtom.cs
- WindowsFormsSectionHandler.cs
- Byte.cs
- XmlNamespaceMapping.cs
- CommonGetThemePartSize.cs
- ComboBox.cs
- InternalResources.cs
- XmlReflectionMember.cs
- FilteredDataSetHelper.cs
- EntityKeyElement.cs
- FuncCompletionCallbackWrapper.cs
- Rfc2898DeriveBytes.cs
- StringFunctions.cs
- FontUnit.cs
- indexingfiltermarshaler.cs
- DomNameTable.cs
- PartitionedStream.cs
- HttpCapabilitiesBase.cs
- clipboard.cs
- DataPagerFieldItem.cs
- DefaultEventAttribute.cs
- WindowsStatusBar.cs
- WorkerRequest.cs
- FtpCachePolicyElement.cs
- XamlVector3DCollectionSerializer.cs
- SrgsDocumentParser.cs
- WorkflowPrinting.cs
- StandardBindingElementCollection.cs
- RepeaterItemCollection.cs
- VectorValueSerializer.cs
- Utility.cs
- NumericUpDownAcceleration.cs
- LocalizabilityAttribute.cs
- HttpVersion.cs
- Timeline.cs
- __ComObject.cs
- RequestBringIntoViewEventArgs.cs
- DataGridViewCellStyleEditor.cs
- HtmlInputFile.cs
- EntityStoreSchemaFilterEntry.cs
- FrameworkElement.cs
- SelectingProviderEventArgs.cs
- RsaSecurityToken.cs
- ServiceNotStartedException.cs
- GlobalEventManager.cs
- AddDataControlFieldDialog.cs
- BasicCellRelation.cs
- SecurityResources.cs
- ActivityBindForm.cs
- SystemFonts.cs
- ModelServiceImpl.cs
- BasicExpressionVisitor.cs
- CompleteWizardStep.cs
- EncryptedData.cs
- CaretElement.cs
- StylusEventArgs.cs
- HuffCodec.cs
- FileDialogCustomPlace.cs
- TraceXPathNavigator.cs
- CqlParserHelpers.cs
- AnnotationResourceChangedEventArgs.cs
- PropertyCollection.cs
- CopyAttributesAction.cs
- ScrollProviderWrapper.cs
- TreePrinter.cs
- SQLConvert.cs
- DesignTimeXamlWriter.cs
- DataDocumentXPathNavigator.cs
- EntityDataSourceUtil.cs
- HttpMethodAttribute.cs
- TimeoutConverter.cs
- SmtpDigestAuthenticationModule.cs
- CodeSnippetStatement.cs
- Control.cs
- MinimizableAttributeTypeConverter.cs