Dispatcher.PushFrame(DispatcherFrame) Dispatcher.PushFrame(DispatcherFrame) Dispatcher.PushFrame(DispatcherFrame) Dispatcher.PushFrame(DispatcherFrame) Method

정의

실행 루프로 들어갑니다.Enters an execute loop.

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

매개 변수

frame
DispatcherFrame DispatcherFrame DispatcherFrame DispatcherFrame

처리할 Dispatcher의 프레임입니다.The frame for the dispatcher to process.

예외

HasShutdownFinishedtrue인 경우HasShutdownFinished is true

또는-or- frame이 다른 Dispatcher에서 실행 중인 경우frame is running on a different Dispatcher.

또는-or- Dispatcher 처리가 비활성화된 경우Dispatcher processing has been disabled.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다는 DispatcherFrame 와 비슷한 결과 달성 하는 Windows FormsWindows Forms DoEvents 메서드.The following example shows how to use a DispatcherFrame to achieve similar results as the Windows FormsWindows Forms DoEvents method.

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
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

설명

DispatcherFrame 보류 중인 작업 항목을 처리 하는 루프를 나타냅니다.A DispatcherFrame represents a loop that processes pending work items.

디스패처 루프에서 작업 항목 큐를 처리합니다.The Dispatcher processes the work item queue in a loop. 루프는 프레임으로 참조 됩니다.The loop is referred to as a frame. 초기 루프는 일반적으로 시작 된 애플리케이션에서 호출 하 여 Run입니다.The initial loop is typically initiated by the application by calling Run.

PushFrame 매개 변수가 나타내는 루프로 frame합니다.PushFrame enters a loop represented by the parameter frame. 루프의 각 반복에서는 Dispatcher 확인 합니다 Continue 속성을는 DispatcherFrame 중지할지 또는 루프를 계속할지 여부를 결정 하는 클래스.At each iteration of the loop, the Dispatcher will check the Continue property on the DispatcherFrame class to determine whether the loop should continue or if it should stop.

DispatcherFrame 허용 합니다 Continue 속성을 명시적으로 설정 해야 하며 준수를 HasShutdownStarted 속성에는 Dispatcher.DispatcherFrame allows for the Continue property to be set explicitly and it respects the HasShutdownStarted property on the Dispatcher. 즉 합니다 Dispatcher 종료를 시작, 기본값을 사용 하는 프레임 DispatcherFrame 구현 종료 하려면 중첩 된 모든 프레임을 사용 하도록 설정 하는 종료 됩니다.This means when the Dispatcher starts to shut down, frames that use the default DispatcherFrame implementation will exit, which enables all nested frames to exit.

보안

UIPermission
에 실행 프레임을 푸시합니다.for pushing an execution frame. 연관 된 열거형: UnrestrictedAssociated enumerations: Unrestricted

적용 대상

추가 정보