Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Base / System / Windows / Threading / DispatcherHooks.cs / 1 / DispatcherHooks.cs
using System.Security;
using System.Security.Permissions;
namespace System.Windows.Threading
{
///
/// Additional information provided about a dispatcher.
///
public sealed class DispatcherHooks
{
///
/// An event indicating the the dispatcher has no more operations to process.
///
///
/// Note that this event will be raised by the dispatcher thread when
/// there is no more pending work to do.
///
/// Note also that this event could come before the last operation is
/// invoked, because that is when we determine that the queue is empty.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _dispatcherInactive
/// TreatAsSafe: link-demands
///
public event EventHandler DispatcherInactive
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_dispatcherInactive += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_dispatcherInactive -= value;
}
}
}
///
/// An event indicating that an operation was posted to the dispatcher.
///
///
/// Typically this is due to the BeginInvoke API, but the Invoke API can
/// also cause this if any priority other than DispatcherPriority.Send is
/// specified, or if the destination dispatcher is owned by a different
/// thread.
///
/// Note that any thread can post operations, so this event can be
/// raised by any thread.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationPosted
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationPosted
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationPosted += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationPosted -= value;
}
}
}
///
/// An event indicating that an operation was completed.
///
///
/// Note that this event will be raised by the dispatcher thread after
/// the operation has completed.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationCompleted
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationCompleted
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationCompleted += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationCompleted -= value;
}
}
}
///
/// An event indicating that the priority of an operation was changed.
///
///
/// Note that any thread can change the priority of operations,
/// so this event can be raised by any thread.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationPriorityChanged
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationPriorityChanged
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationPriorityChanged += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationPriorityChanged -= value;
}
}
}
///
/// An event indicating that an operation was aborted.
///
///
/// Note that any thread can abort an operation, so this event
/// can be raised by any thread.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationAborted
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationAborted += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationAborted -= value;
}
}
}
// Only we can create these things.
internal DispatcherHooks()
{
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseDispatcherInactive(Dispatcher dispatcher)
{
EventHandler dispatcherInactive = _dispatcherInactive;
if(dispatcherInactive != null)
{
dispatcherInactive(dispatcher, EventArgs.Empty);
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationPosted(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationPosted = _operationPosted;
if(operationPosted != null)
{
operationPosted(dispatcher, new DispatcherHookEventArgs(operation));
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationCompleted(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationCompleted = _operationCompleted;
if(operationCompleted != null)
{
operationCompleted(dispatcher, new DispatcherHookEventArgs(operation));
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationPriorityChanged(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationPriorityChanged = _operationPriorityChanged;
if(operationPriorityChanged != null)
{
operationPriorityChanged(dispatcher, new DispatcherHookEventArgs(operation));
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationAborted(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationAborted = _operationAborted;
if(operationAborted != null)
{
operationAborted(dispatcher, new DispatcherHookEventArgs(operation));
}
}
private object _instanceLock = new object();
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private EventHandler _dispatcherInactive;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationPosted;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationCompleted;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationPriorityChanged;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationAborted;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System.Security;
using System.Security.Permissions;
namespace System.Windows.Threading
{
///
/// Additional information provided about a dispatcher.
///
public sealed class DispatcherHooks
{
///
/// An event indicating the the dispatcher has no more operations to process.
///
///
/// Note that this event will be raised by the dispatcher thread when
/// there is no more pending work to do.
///
/// Note also that this event could come before the last operation is
/// invoked, because that is when we determine that the queue is empty.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _dispatcherInactive
/// TreatAsSafe: link-demands
///
public event EventHandler DispatcherInactive
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_dispatcherInactive += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_dispatcherInactive -= value;
}
}
}
///
/// An event indicating that an operation was posted to the dispatcher.
///
///
/// Typically this is due to the BeginInvoke API, but the Invoke API can
/// also cause this if any priority other than DispatcherPriority.Send is
/// specified, or if the destination dispatcher is owned by a different
/// thread.
///
/// Note that any thread can post operations, so this event can be
/// raised by any thread.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationPosted
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationPosted
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationPosted += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationPosted -= value;
}
}
}
///
/// An event indicating that an operation was completed.
///
///
/// Note that this event will be raised by the dispatcher thread after
/// the operation has completed.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationCompleted
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationCompleted
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationCompleted += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationCompleted -= value;
}
}
}
///
/// An event indicating that the priority of an operation was changed.
///
///
/// Note that any thread can change the priority of operations,
/// so this event can be raised by any thread.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationPriorityChanged
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationPriorityChanged
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationPriorityChanged += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationPriorityChanged -= value;
}
}
}
///
/// An event indicating that an operation was aborted.
///
///
/// Note that any thread can abort an operation, so this event
/// can be raised by any thread.
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: link-demands
///
public event DispatcherHookEventHandler OperationAborted
{
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
add
{
lock(_instanceLock)
{
_operationAborted += value;
}
}
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
remove
{
lock(_instanceLock)
{
_operationAborted -= value;
}
}
}
// Only we can create these things.
internal DispatcherHooks()
{
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseDispatcherInactive(Dispatcher dispatcher)
{
EventHandler dispatcherInactive = _dispatcherInactive;
if(dispatcherInactive != null)
{
dispatcherInactive(dispatcher, EventArgs.Empty);
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationPosted(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationPosted = _operationPosted;
if(operationPosted != null)
{
operationPosted(dispatcher, new DispatcherHookEventArgs(operation));
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationCompleted(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationCompleted = _operationCompleted;
if(operationCompleted != null)
{
operationCompleted(dispatcher, new DispatcherHookEventArgs(operation));
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationPriorityChanged(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationPriorityChanged = _operationPriorityChanged;
if(operationPriorityChanged != null)
{
operationPriorityChanged(dispatcher, new DispatcherHookEventArgs(operation));
}
}
///
/// Critical: accesses _operationAborted
/// TreatAsSafe: no exposure
///
[SecurityCritical, SecurityTreatAsSafe]
internal void RaiseOperationAborted(Dispatcher dispatcher, DispatcherOperation operation)
{
DispatcherHookEventHandler operationAborted = _operationAborted;
if(operationAborted != null)
{
operationAborted(dispatcher, new DispatcherHookEventArgs(operation));
}
}
private object _instanceLock = new object();
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private EventHandler _dispatcherInactive;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationPosted;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationCompleted;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationPriorityChanged;
///
/// Do not expose to partially trusted code.
///
[SecurityCritical]
private DispatcherHookEventHandler _operationAborted;
}
}
// 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
- SessionState.cs
- ArgumentValueSerializer.cs
- TreeIterator.cs
- TreeNodeBindingCollection.cs
- ScrollViewer.cs
- TextBoxView.cs
- ListViewInsertedEventArgs.cs
- SelectionList.cs
- ObjectDataSourceStatusEventArgs.cs
- SoapIncludeAttribute.cs
- Triangle.cs
- FixedSOMPage.cs
- XPathDocument.cs
- ConfigurationProperty.cs
- TypeDescriptionProvider.cs
- MailBnfHelper.cs
- AsymmetricSignatureFormatter.cs
- WindowsGraphicsCacheManager.cs
- WebPartExportVerb.cs
- DataGridViewColumnCollection.cs
- SHA1CryptoServiceProvider.cs
- __ConsoleStream.cs
- GetChildSubtree.cs
- ClientTargetCollection.cs
- ColorAnimation.cs
- MatrixStack.cs
- GPPOINT.cs
- BridgeDataRecord.cs
- IndicShape.cs
- WebPartChrome.cs
- Vector3DAnimationUsingKeyFrames.cs
- PnrpPeerResolverElement.cs
- IdentifierService.cs
- ContentPresenter.cs
- ProcessInputEventArgs.cs
- DesignerSerializationManager.cs
- RootBuilder.cs
- TextServicesCompartmentContext.cs
- CursorConverter.cs
- SHA512Managed.cs
- OdbcStatementHandle.cs
- ThemeDirectoryCompiler.cs
- CacheEntry.cs
- FormClosingEvent.cs
- BamlMapTable.cs
- ForceCopyBuildProvider.cs
- VisualCollection.cs
- ErrorWrapper.cs
- EditingMode.cs
- X509Certificate2Collection.cs
- Decoder.cs
- CacheDict.cs
- ForEachAction.cs
- TokenizerHelper.cs
- Rotation3DAnimation.cs
- CustomTypeDescriptor.cs
- HttpStreamMessage.cs
- WebPartsPersonalization.cs
- BidPrivateBase.cs
- OracleSqlParser.cs
- Delegate.cs
- DataRecordInfo.cs
- MetadataCacheItem.cs
- TransactionFormatter.cs
- CodeDomSerializer.cs
- DataTableNewRowEvent.cs
- DotAtomReader.cs
- SignatureDescription.cs
- DropShadowBitmapEffect.cs
- Ipv6Element.cs
- ConfigurationException.cs
- CodeDirectiveCollection.cs
- HtmlInputText.cs
- ConvertBinder.cs
- TaiwanCalendar.cs
- DataGridCellAutomationPeer.cs
- ContainerSelectorActiveEvent.cs
- Int64AnimationUsingKeyFrames.cs
- XNameTypeConverter.cs
- MessagePartSpecification.cs
- ObjectCloneHelper.cs
- FilterEventArgs.cs
- Attributes.cs
- TypeLibConverter.cs
- Validator.cs
- EntityViewGenerationAttribute.cs
- ComplexObject.cs
- DataGridViewCellValueEventArgs.cs
- HttpHeaderCollection.cs
- Win32PrintDialog.cs
- CursorEditor.cs
- TextBreakpoint.cs
- CellLabel.cs
- LogRestartAreaEnumerator.cs
- RuntimeConfigLKG.cs
- Subtree.cs
- Calendar.cs
- _NestedMultipleAsyncResult.cs
- FullTextBreakpoint.cs
- ModelProperty.cs