语言

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

属性值

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 中使用。

适用于

另请参阅