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

屬性

範例

下列範例示範如何使用 DispatcherFrame 來達成類似Windows Forms 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 中使用。

適用於

另請參閱