다음을 통해 공유


InputActivationListener 클래스

정의

개체의 활성화 상태에 대한 변경 내용에 액세스하고 관찰하는 기능을 제공합니다.

public ref class InputActivationListener sealed : InputObject
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65537)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class InputActivationListener final : InputObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65537)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InputActivationListener : InputObject
Public NotInheritable Class InputActivationListener
Inherits InputObject
상속
Object Platform::Object IInspectable InputObject InputActivationListener
특성

예제

다음 Windows 앱 SDK 예제에서는 개체의 활성화 이벤트에 Microsoft.UI.Windowing.AppWindow 응답하는 방법을 보여 줍니다.

class RespondToAppWindowActivation
{
    InputActivationListener inputActivationListener;

    public RespondToAppWindowActivation(Microsoft.UI.Windowing.AppWindow appWindow)
    {
        inputActivationListener = InputActivationListener.GetForWindowId(appWindow.Id);

        inputActivationListener.InputActivationChanged += OnActivationChanged;
    }

    void OnActivationChanged(
        InputActivationListener sender,
        InputActivationListenerActivationChangedEventArgs args)
    {
        if (sender.State == InputActivationState.Activated)
        {
            System.Diagnostics.Debug.WriteLine("AppWindow was activated.");

            LeaveMyBackgroundMode();
        }
        else
        {
            System.Diagnostics.Debug.WriteLine("AppWindow was deactivated.");

            EnterMyBackgroundMode();
        }
    }
}

설명

InputActivationListener와 연결된 개체가 제거되면 InputActivationListener 개체가 암시적으로 삭제됩니다. 자세한 내용은 InputObject 를 참조하세요.

속성

DispatcherQueue

InputObject에 대한 DispatcherQueue 를 가져옵니다.

(다음에서 상속됨 InputObject)
State

개체의 활성화 상태를 가져옵니다.

메서드

GetForIsland(ContentIsland)

InputActivationListener 지정된 ContentIsland에 대한 개체를 검색합니다.

GetForWindowId(WindowId)

InputActivationListener 지정된 최상위 창에 대한 개체를 검색합니다.

이벤트

InputActivationChanged

연결된 개체의 입력 활성화 상태가 변경될 때 발생합니다.

적용 대상

추가 정보