DispatcherFrame.Continue 属性

定义

获取或设置一个值,该值指示此 DispatcherFrame 是否应该继续。

public:
 property bool Continue { bool get(); void set(bool value); };
public bool Continue { get; [System.Security.SecurityCritical] set; }
public bool Continue { get; set; }
[<set: System.Security.SecurityCritical>]
member this.Continue : bool with get, set
member this.Continue : bool with get, set
Public Property Continue As Boolean

属性值

Boolean

如果此帧应该继续,则为 true;否则为 false。 默认值是 true

属性

示例

以下示例演示如何使用 a DispatcherFrame 实现与Windows 窗体DoEvents方法类似的结果。

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

注解

Continue 在每个调度程序循环的顶部查询。

在应用程序关闭时,请求退出所有帧。

XAML 文本用法

此类的成员通常不在 XAML 中使用,或不能在 XAML 中使用。

适用于

另请参阅