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
- EndpointDiscoveryMetadata.cs
- DecoderFallback.cs
- IntSecurity.cs
- CqlIdentifiers.cs
- OneWayBindingElementImporter.cs
- ManipulationLogic.cs
- ArgumentNullException.cs
- CDSCollectionETWBCLProvider.cs
- ModelPropertyCollectionImpl.cs
- Empty.cs
- Timeline.cs
- BitmapData.cs
- _ListenerResponseStream.cs
- GenericTypeParameterBuilder.cs
- DragDropHelper.cs
- WebBaseEventKeyComparer.cs
- SupportsEventValidationAttribute.cs
- PriorityRange.cs
- WsdlImporter.cs
- ValueTypeFieldReference.cs
- ControlBindingsCollection.cs
- RequestQueue.cs
- Window.cs
- StylusButtonEventArgs.cs
- SystemResourceKey.cs
- NameValueConfigurationCollection.cs
- StatusBarItem.cs
- WebPartEventArgs.cs
- WebServiceReceiveDesigner.cs
- Variable.cs
- FontEmbeddingManager.cs
- PreviewPageInfo.cs
- NonSerializedAttribute.cs
- PasswordRecovery.cs
- WindowsListView.cs
- PriorityChain.cs
- HtmlInputCheckBox.cs
- CalendarDataBindingHandler.cs
- ArcSegment.cs
- CodeTypeConstructor.cs
- ReadOnlyHierarchicalDataSource.cs
- NumberFormatInfo.cs
- ImageClickEventArgs.cs
- WsrmFault.cs
- FontEmbeddingManager.cs
- SqlRowUpdatingEvent.cs
- PlatformCulture.cs
- securitycriticaldataformultiplegetandset.cs
- ContentValidator.cs
- SqlServer2KCompatibilityAnnotation.cs
- InkCanvas.cs
- UnsafeNativeMethods.cs
- HostedTransportConfigurationManager.cs
- DataGridViewCellValueEventArgs.cs
- HtmlEmptyTagControlBuilder.cs
- TypeUnloadedException.cs
- ImageMap.cs
- Form.cs
- Expression.cs
- PropertyDescriptorGridEntry.cs
- XmlCodeExporter.cs
- PropagatorResult.cs
- DataGridTemplateColumn.cs
- SerializationIncompleteException.cs
- SystemIcons.cs
- SqlDataRecord.cs
- SymmetricCryptoHandle.cs
- DataSourceHelper.cs
- ChtmlTextBoxAdapter.cs
- BinarySerializer.cs
- RadioButton.cs
- ToolConsole.cs
- AppDomain.cs
- GridViewUpdatedEventArgs.cs
- SqlCachedBuffer.cs
- CipherData.cs
- translator.cs
- Vector3DCollectionConverter.cs
- TransformationRules.cs
- RequestCacheValidator.cs
- CannotUnloadAppDomainException.cs
- ReadOnlyMetadataCollection.cs
- httpapplicationstate.cs
- DbException.cs
- LayoutEditorPart.cs
- NameScopePropertyAttribute.cs
- Subtree.cs
- DataGridBoolColumn.cs
- SwitchExpression.cs
- SocketPermission.cs
- EventManager.cs
- CallTemplateAction.cs
- AsyncOperationContext.cs
- TextServicesContext.cs
- DbgUtil.cs
- StylusPointPropertyId.cs
- UserControlParser.cs
- ApplicationBuildProvider.cs
- XPathNodeIterator.cs
- CurrencyWrapper.cs