DispatcherFrame Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents an execution loop in the Dispatcher.
public ref class DispatcherFrame : System::Windows::Threading::DispatcherObject
public class DispatcherFrame : System.Windows.Threading.DispatcherObject
type DispatcherFrame = class
inherit DispatcherObject
Public Class DispatcherFrame
Inherits DispatcherObject
- Inheritance
The following example shows how to use a DispatcherFrame to achieve similar results as the Windows Forms DoEvents method.
public void DoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
new DispatcherOperationCallback(ExitFrame), frame);
Dispatcher.PushFrame(frame);
}
public object ExitFrame(object f)
{
((DispatcherFrame)f).Continue = false;
return null;
}
<SecurityPermissionAttribute(SecurityAction.Demand, Flags := SecurityPermissionFlag.UnmanagedCode)>
Public Sub DoEvents()
Dim frame As New DispatcherFrame()
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, New DispatcherOperationCallback(AddressOf ExitFrame), frame)
Dispatcher.PushFrame(frame)
End Sub
Public Function ExitFrame(ByVal f As Object) As Object
CType(f, DispatcherFrame).Continue = False
Return Nothing
End Function
DispatcherFrame objects typically fall into two categories:
Long running, general purpose frames that exit only when instructed to. These frames should exit when they are requested.
Short running, very specific frames that exit when an important criteria is met. These frames may consider not to exit when they are requested in favor of waiting for their exit criteria to be met. These frames should have a time-out associated with them.
You cannot use this managed class in XAML.
Dispatcher |
Initializes a new instance of the DispatcherFrame class. |
Dispatcher |
Initializes a new instance of the DispatcherFrame class, by using the specified exit request flag. |
Continue |
Gets or sets a value that indicates whether this DispatcherFrame should continue. |
Dispatcher |
Gets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject) |
Check |
Determines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject) |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
Verify |
Enforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject) |
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: