ProtocolActivatedEventArgs クラス

定義

URI スキーム名に関連付けられているアプリであるため、アプリがアクティブ化されたときにデータを提供します。

Javascript この型は 、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
   } 
}

注釈

このオブジェクトは、ActivationKindProtocol の場合にアクティブ化されたイベントに応答するイベント ハンドラーを実装するときにアクセスされます。

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

アプリケーションのビューを設定できるビュー スイッチャー オブジェクトを取得します。

適用対象

こちらもご覧ください