Dispatcher.PushFrame(DispatcherFrame) 메서드

정의

실행 루프로 들어갑니다.

public:
 static void PushFrame(System::Windows::Threading::DispatcherFrame ^ frame);
[System.Security.SecurityCritical]
public static void PushFrame (System.Windows.Threading.DispatcherFrame frame);
public static void PushFrame (System.Windows.Threading.DispatcherFrame frame);
[<System.Security.SecurityCritical>]
static member PushFrame : System.Windows.Threading.DispatcherFrame -> unit
static member PushFrame : System.Windows.Threading.DispatcherFrame -> unit
Public Shared Sub PushFrame (frame As DispatcherFrame)

매개 변수

frame
DispatcherFrame

처리할 Dispatcher의 프레임입니다.

특성

예외

frame이(가) null인 경우

HasShutdownFinishedtrue인 경우

또는 frame이 다른 Dispatcher에서 실행 중인 경우

또는 Dispatcher 처리가 비활성화된 경우

예제

다음 예제에서는 Windows Forms DoEvents 메서드와 비슷한 결과를 얻기 위해 사용하는 DispatcherFrame 방법을 보여 있습니다.

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

설명

A DispatcherFrame 는 보류 중인 작업 항목을 처리하는 루프를 나타냅니다.

Dispatcher는 루프에서 작업 항목 큐를 처리합니다. 루프를 프레임이라고 합니다. 초기 루프는 일반적으로 시작 된 애플리케이션에서 호출 하 여 Run입니다.

PushFrame 는 매개 변수 frame로 표시되는 루프를 입력합니다. 루프를 반복할 때마다 클래스 Dispatcher 의 속성을 DispatcherFrame 확인 Continue 하여 루프를 계속할지 또는 중지해야 하는지 여부를 결정합니다.

DispatcherFrame 에서는 Continue 속성을 명시적으로 설정할 수 있으며 HasShutdownStarted Dispatcher. 즉, 종료가 시작되면 Dispatcher 기본 DispatcherFrame 구현을 사용하는 프레임이 종료되므로 중첩된 모든 프레임이 종료됩니다.

적용 대상

추가 정보