Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / System / Windows / Threading / DispatcherFrame.cs / 1 / DispatcherFrame.cs
using System; using System.Security; namespace System.Windows.Threading { ////// Representation of Dispatcher frame. /// public class DispatcherFrame : DispatcherObject { ////// Critical: This code exists to ensure that the static variables initialized /// do not cause security violations.The reason this comes into existance is because /// of the call to RegisterWindowMessage /// TreatAsSafe:This is safe to call /// [SecurityCritical,SecurityTreatAsSafe] static DispatcherFrame() { } ////// Constructs a new instance of the DispatcherFrame class. /// public DispatcherFrame() : this(true) { } ////// Constructs a new instance of the DispatcherFrame class. /// /// /// Indicates whether or not this frame will exit when all frames /// are requested to exit. /// /// Dispatcher frames typically break down into two categories: /// 1) Long running, general purpose frames, that exit only when /// told to. These frames should exit when requested. /// 2) Short running, very specific frames that exit themselves /// when an important criteria is met. These frames may /// consider not exiting when requested in favor of waiting /// for their important criteria to be met. These frames /// should have a timeout associated with them. /// public DispatcherFrame(bool exitWhenRequested) { _exitWhenRequested = exitWhenRequested; _continue = true; } ////// Indicates that this dispatcher frame should exit. /// ////// Critical - calls a critical method - postThreadMessage. /// PublicOK - all we're doing is posting a current message to our thread. /// net effect is the dispatcher "wakes up" /// and uses the continue flag ( which may have just changed). /// public bool Continue { get { // This method is free-threaded. // First check if this frame wants to continue. bool shouldContinue = _continue; if(shouldContinue) { // This frame wants to continue, so next check if it will // respect the "exit requests" from the dispatcher. if(_exitWhenRequested) { Dispatcher dispatcher = Dispatcher; // This frame is willing to respect the "exit requests" of // the dispatcher, so check them. if(dispatcher._exitAllFrames || dispatcher._hasShutdownStarted) { shouldContinue = false; } } } return shouldContinue; } [SecurityCritical] set { // This method is free-threaded. _continue = value; // Post a message so that the message pump will wake up and // check our continue state. Dispatcher.BeginInvoke(DispatcherPriority.Send, (DispatcherOperationCallback) delegate(object unused) {return null;}, null); } } private bool _exitWhenRequested; private bool _continue; } } // 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
- DataServiceQueryException.cs
- Visual.cs
- TraceLevelHelper.cs
- DataGridTextBox.cs
- KernelTypeValidation.cs
- ReliableChannelFactory.cs
- ManipulationCompletedEventArgs.cs
- SamlAssertionKeyIdentifierClause.cs
- FixedSOMPageElement.cs
- DisplayMemberTemplateSelector.cs
- SystemColors.cs
- Application.cs
- EntitySqlQueryState.cs
- Emitter.cs
- BufferManager.cs
- AliasExpr.cs
- ComUdtElement.cs
- OutgoingWebRequestContext.cs
- StorageEntityTypeMapping.cs
- HtmlWindow.cs
- HandoffBehavior.cs
- TraceContextRecord.cs
- ListViewEditEventArgs.cs
- Stack.cs
- UpDownEvent.cs
- XmlQueryCardinality.cs
- CompilerResults.cs
- NoResizeSelectionBorderGlyph.cs
- MethodExpr.cs
- WindowHideOrCloseTracker.cs
- Math.cs
- WizardSideBarListControlItemEventArgs.cs
- Parallel.cs
- RichTextBoxConstants.cs
- GestureRecognitionResult.cs
- behaviorssection.cs
- DataKey.cs
- selecteditemcollection.cs
- EastAsianLunisolarCalendar.cs
- UpdateManifestForBrowserApplication.cs
- WmlLinkAdapter.cs
- CompilationAssemblyInstallComponent.cs
- RelationshipManager.cs
- wgx_exports.cs
- UriTemplate.cs
- ToolStripArrowRenderEventArgs.cs
- SafeSerializationManager.cs
- RijndaelManagedTransform.cs
- FrameDimension.cs
- OracleInfoMessageEventArgs.cs
- PackagePartCollection.cs
- XPathArrayIterator.cs
- PropertiesTab.cs
- CommandLibraryHelper.cs
- TextSelectionHighlightLayer.cs
- ToolBarButtonClickEvent.cs
- XmlUnspecifiedAttribute.cs
- ConstructorArgumentAttribute.cs
- DesignerActionVerbItem.cs
- StandardToolWindows.cs
- SerializationInfo.cs
- ProxyFragment.cs
- DesignerActionService.cs
- DisableDpiAwarenessAttribute.cs
- PageContent.cs
- NameObjectCollectionBase.cs
- OletxEnlistment.cs
- FrameworkContextData.cs
- GenericEnumerator.cs
- EditCommandColumn.cs
- X509SecurityToken.cs
- RawStylusSystemGestureInputReport.cs
- SqlCommandSet.cs
- ObjectList.cs
- StructureChangedEventArgs.cs
- HGlobalSafeHandle.cs
- AppSettingsExpressionBuilder.cs
- WebServiceErrorEvent.cs
- SystemIcons.cs
- OleDbWrapper.cs
- ToolBarTray.cs
- SafeFileHandle.cs
- Connector.xaml.cs
- Win32PrintDialog.cs
- MenuItemBinding.cs
- EntityProviderFactory.cs
- ErrorProvider.cs
- PersistenceTypeAttribute.cs
- BezierSegment.cs
- ObjectQueryExecutionPlan.cs
- PackagePartCollection.cs
- ThreadAttributes.cs
- QilScopedVisitor.cs
- DesignerSerializationOptionsAttribute.cs
- Crypto.cs
- PathFigureCollectionValueSerializer.cs
- HierarchicalDataBoundControl.cs
- ComplusTypeValidator.cs
- BigInt.cs
- ActivityCodeDomReferenceService.cs