ProtocolActivatedEventArgs 클래스

정의

앱이 URI 스키마 이름과 연결된 앱이므로 앱이 활성화될 때 데이터를 제공합니다.

자바 스크립트 이 형식은 WebUIProtocolActivatedEventArgs로 표시됩니다.

public ref class ProtocolActivatedEventArgs sealed : IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
public ref class ProtocolActivatedEventArgs sealed : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ProtocolActivatedEventArgs final : IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ProtocolActivatedEventArgs final : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ProtocolActivatedEventArgs : IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ProtocolActivatedEventArgs : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
Public NotInheritable Class ProtocolActivatedEventArgs
Implements IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
Public NotInheritable Class ProtocolActivatedEventArgs
Implements IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
상속
Object Platform::Object IInspectable ProtocolActivatedEventArgs
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

OnActivated 이벤트 처리기는 모든 활성화 이벤트를 받습니다. 속성은 활성화 이벤트의 유형을 나타냅니다. 이 예제는 URI 활성화 이벤트를 처리하도록 설정됩니다.

public partial class App
{
   protected override void OnActivated(IActivatedEventArgs args)
   {
      if (args.Kind == ActivationKind.Protocol)
      {
         ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;

         // TODO: Handle URI activation
         // The received URI is eventArgs.Uri.AbsoluteUri
      }
   }
}
Private Sub OnFileActivated(ByVal args As Windows.ApplicationModel.Activation.IActivatedEventArgs)
   If args.Kind = ActivationKind.Protocol Then
      ProtocolActivatedEventArgs eventArgs = args As ProtocolActivatedEventArgs

      ' TODO: Handle URI activation
      ' The received URI is eventArgs.Uri.AbsoluteUri
   End If
End Sub
void App::OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs const& args)
{
    if (args.Kind() == Windows::ApplicationModel::Activation::ActivationKind::Protocol)
    {
        auto eventArgs{ args.as<Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs>() };

        // TODO: Handle URI activation.
        // The received URI is eventArgs.Uri().RawUri().
    }
}
void App::OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs^ args)
{
   if (args->Kind == Windows::ApplicationModel::Activation::ActivationKind::Protocol)
   {
      Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ eventArgs = 
          dynamic_cast<Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^>(args);

      // TODO: Handle URI activation  
      // The received URI is eventArgs->Uri->RawUri
   } 
}

설명

이 개체는 ActivationKind가 Protocol일 때 활성화된 이벤트에 응답하는 이벤트 처리기를 구현할 때 액세스됩니다.

C++, C#또는 Visual Basic을 사용하는 UWP 앱은 일반적으로 Application 개체의 메서드를 재정의하여 활성화 지점을 구현합니다. 기본 템플릿 app.xaml 코드 숨김 파일에는 항상 OnLaunched에 대한 재정의가 포함되어 있지만 OnActivated 와 같은 다른 활성화 지점에 대한 재정의 정의는 앱 코드에 달려 있습니다. ActivationKindProtocol이면 OnActivated의 인터페이스 형식 IActivatedEventArgs를 ProtocolActivatedEventArgs로 캐스팅할 수 있습니다.

활성화 시나리오와 관련된 모든 애플리케이션 재정의는 해당 구현에서 Window.Activate 를 호출해야 합니다.

버전 기록

Windows 버전 SDK 버전 추가된 값
1607 14393 사용자

속성

CallerPackageFamilyName

현재 애플리케이션을 활성화한 애플리케이션의 패키지 패밀리 이름을 가져옵니다.

CurrentlyShownApplicationViewId

현재 표시된 앱 보기의 식별자를 가져옵니다.

Data

현재 애플리케이션을 활성화한 애플리케이션에서 받은 데이터입니다.

Kind

활성화 유형을 가져옵니다.

PreviousExecutionState

활성화되기 전에 앱의 실행 상태를 가져옵니다.

SplashScreen

시작 화면에서 활성화된 앱으로의 전환에 대한 정보를 제공하는 시작 화면 개체를 가져옵니다.

Uri

앱이 활성화된 URI(Uniform Resource Identifier)를 가져옵니다.

User

앱이 활성화된 사용자를 가져옵니다.

ViewSwitcher

애플리케이션에 대한 보기를 설정할 수 있는 뷰 전환기 개체를 가져옵니다.

적용 대상

추가 정보