편집

다음을 통해 공유


DispatcherFrame Class

Definition

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
DispatcherFrame

Examples

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

Remarks

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.

XAML Text Usage

You cannot use this managed class in XAML.

Constructors

DispatcherFrame()

Initializes a new instance of the DispatcherFrame class.

DispatcherFrame(Boolean)

Initializes a new instance of the DispatcherFrame class, by using the specified exit request flag.

Properties

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)

Methods

CheckAccess()

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)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

Applies to

See also