Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Base / System / Windows / Threading / DispatcherExceptionFilterEventArgs.cs / 1 / DispatcherExceptionFilterEventArgs.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description: Arguments for the ExceptionFilter event. The event is raised
// when a dispatcher exception has occured. This event is raised
// before the callstack is unwound.
//
// History:
// 07/22/2003 : KenLai - Created
//
//---------------------------------------------------------------------------
using System.Diagnostics;
using System;
namespace System.Windows.Threading
{
///
/// Arguments for the ExceptionFilter event. The event is raised when
/// a dispatcher exception has occured.
///
///
/// This event is raised before the callstack is unwound.
///
public sealed class DispatcherUnhandledExceptionFilterEventArgs : DispatcherEventArgs
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
// Initialize a new event argument.
internal DispatcherUnhandledExceptionFilterEventArgs(Dispatcher dispatcher)
: base(dispatcher)
{
}
//------------------------------------------------------
//
// Public Properties
//
//-----------------------------------------------------
///
/// The exception that was raised on a thread operating within
/// the dispatcher.
///
public Exception Exception
{
get
{
return _exception;
}
}
///
/// Whether or not the exception should be caught and the exception
/// event handlers called.
///
///
/// A filter handler can set this property to false to request that
/// the exception not be caught, to avoid the callstack getting
/// unwound up to the Dispatcher.
///
/// A previous handler in the event multicast might have already set this
/// property to false, signalling that the exception will not be caught.
/// We let the "don't catch" behavior override all others because
/// it most likely means a debugging scenario.
///
public bool RequestCatch
{
get
{
return _requestCatch;
}
set
{
// Only allow to be set false.
if (value == false)
{
_requestCatch = value;
}
}
}
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
///
/// Initialize the preallocated args class for use.
///
///
/// This method MUST NOT FAIL because it is called from an exception
/// handler: do not do any heavy lifting or allocate more memory.
/// This initialization step is separated from the constructor
/// precisely because we wanted to preallocate the memory and avoid
/// hitting a secondary exception in the out-of-memory case.
///
///
/// The exception that was raised while executing code via the
/// dispatcher.
///
///
/// Whether or not the exception should be caught and the
/// exception handlers called.
///
internal void Initialize(Exception exception, bool requestCatch)
{
Debug.Assert(exception != null);
_exception = exception;
_requestCatch = requestCatch;
}
//-----------------------------------------------------
//
// Private Fields
//
//------------------------------------------------------
private Exception _exception;
private bool _requestCatch;
}
///
/// Delegate for the events that convey the state of the UiConext
/// in response to various actions that involve items.
///
public delegate void DispatcherUnhandledExceptionFilterEventHandler(object sender, DispatcherUnhandledExceptionFilterEventArgs e);
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description: Arguments for the ExceptionFilter event. The event is raised
// when a dispatcher exception has occured. This event is raised
// before the callstack is unwound.
//
// History:
// 07/22/2003 : KenLai - Created
//
//---------------------------------------------------------------------------
using System.Diagnostics;
using System;
namespace System.Windows.Threading
{
///
/// Arguments for the ExceptionFilter event. The event is raised when
/// a dispatcher exception has occured.
///
///
/// This event is raised before the callstack is unwound.
///
public sealed class DispatcherUnhandledExceptionFilterEventArgs : DispatcherEventArgs
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
// Initialize a new event argument.
internal DispatcherUnhandledExceptionFilterEventArgs(Dispatcher dispatcher)
: base(dispatcher)
{
}
//------------------------------------------------------
//
// Public Properties
//
//-----------------------------------------------------
///
/// The exception that was raised on a thread operating within
/// the dispatcher.
///
public Exception Exception
{
get
{
return _exception;
}
}
///
/// Whether or not the exception should be caught and the exception
/// event handlers called.
///
///
/// A filter handler can set this property to false to request that
/// the exception not be caught, to avoid the callstack getting
/// unwound up to the Dispatcher.
///
/// A previous handler in the event multicast might have already set this
/// property to false, signalling that the exception will not be caught.
/// We let the "don't catch" behavior override all others because
/// it most likely means a debugging scenario.
///
public bool RequestCatch
{
get
{
return _requestCatch;
}
set
{
// Only allow to be set false.
if (value == false)
{
_requestCatch = value;
}
}
}
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
///
/// Initialize the preallocated args class for use.
///
///
/// This method MUST NOT FAIL because it is called from an exception
/// handler: do not do any heavy lifting or allocate more memory.
/// This initialization step is separated from the constructor
/// precisely because we wanted to preallocate the memory and avoid
/// hitting a secondary exception in the out-of-memory case.
///
///
/// The exception that was raised while executing code via the
/// dispatcher.
///
///
/// Whether or not the exception should be caught and the
/// exception handlers called.
///
internal void Initialize(Exception exception, bool requestCatch)
{
Debug.Assert(exception != null);
_exception = exception;
_requestCatch = requestCatch;
}
//-----------------------------------------------------
//
// Private Fields
//
//------------------------------------------------------
private Exception _exception;
private bool _requestCatch;
}
///
/// Delegate for the events that convey the state of the UiConext
/// in response to various actions that involve items.
///
public delegate void DispatcherUnhandledExceptionFilterEventHandler(object sender, DispatcherUnhandledExceptionFilterEventArgs e);
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XPathChildIterator.cs
- CapabilitiesAssignment.cs
- PropertyChangedEventArgs.cs
- SplashScreen.cs
- ToolStripStatusLabel.cs
- UnsafeNativeMethods.cs
- SmtpClient.cs
- MatrixKeyFrameCollection.cs
- ByteArrayHelperWithString.cs
- SmtpTransport.cs
- InheritablePropertyChangeInfo.cs
- ProviderConnectionPoint.cs
- XPathNavigator.cs
- DefaultTextStoreTextComposition.cs
- ObjectParameter.cs
- PropertyFilterAttribute.cs
- StringResourceManager.cs
- SystemIcmpV6Statistics.cs
- AspCompat.cs
- Common.cs
- OleDbInfoMessageEvent.cs
- OrderByLifter.cs
- Transactions.cs
- DetailsViewCommandEventArgs.cs
- ApplicationServicesHostFactory.cs
- PassportAuthenticationEventArgs.cs
- GeometryModel3D.cs
- QueryCursorEventArgs.cs
- LogicalExpr.cs
- CompensationToken.cs
- HostDesigntimeLicenseContext.cs
- DependencyPropertyAttribute.cs
- HttpConfigurationContext.cs
- COM2IDispatchConverter.cs
- ContextStack.cs
- XmlWriterTraceListener.cs
- ManualResetEventSlim.cs
- ComponentGuaranteesAttribute.cs
- TraversalRequest.cs
- ProgressBar.cs
- BindingExpressionUncommonField.cs
- SoapAttributeOverrides.cs
- SQLMoneyStorage.cs
- NullPackagingPolicy.cs
- DataProtection.cs
- XmlIgnoreAttribute.cs
- Utils.cs
- AdCreatedEventArgs.cs
- SerializationInfo.cs
- TemplateXamlTreeBuilder.cs
- EmptyEnumerator.cs
- ColorConvertedBitmapExtension.cs
- BaseAppDomainProtocolHandler.cs
- UriTemplateLiteralPathSegment.cs
- OpCellTreeNode.cs
- CanonicalizationDriver.cs
- ScriptDescriptor.cs
- StringReader.cs
- LicenseException.cs
- WebControlAdapter.cs
- InstanceKeyNotReadyException.cs
- ValidationSummary.cs
- LineVisual.cs
- TemplateInstanceAttribute.cs
- Pen.cs
- IRCollection.cs
- RequestCache.cs
- LinqDataSourceStatusEventArgs.cs
- PseudoWebRequest.cs
- WebScriptMetadataFormatter.cs
- CodeTypeParameterCollection.cs
- CodeNamespaceCollection.cs
- KeyboardDevice.cs
- Domain.cs
- HyperlinkAutomationPeer.cs
- NamespaceMapping.cs
- ExpressionLink.cs
- HijriCalendar.cs
- DependencyPropertyAttribute.cs
- TreeNodeBindingDepthConverter.cs
- CachedTypeface.cs
- InitiatorSessionSymmetricMessageSecurityProtocol.cs
- FillBehavior.cs
- ConfigurationCollectionAttribute.cs
- SizeAnimation.cs
- IDReferencePropertyAttribute.cs
- Oid.cs
- BaseResourcesBuildProvider.cs
- BaseConfigurationRecord.cs
- TransformGroup.cs
- WinInet.cs
- LogExtentCollection.cs
- Point4D.cs
- DataGridColumnReorderingEventArgs.cs
- CharacterBuffer.cs
- AppSecurityManager.cs
- CompilerWrapper.cs
- HMACMD5.cs
- StateMachine.cs
- Point3DConverter.cs