FileActivatedEventArgs クラス

定義

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

Javascript この型は WebUIFileActivatedEventArgs として表示されます。

public ref class FileActivatedEventArgs sealed : IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
public ref class FileActivatedEventArgs sealed : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileActivatedEventArgs final : IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileActivatedEventArgs final : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileActivatedEventArgs : IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileActivatedEventArgs : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
Public NotInheritable Class FileActivatedEventArgs
Implements IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
Public NotInheritable Class FileActivatedEventArgs
Implements IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
継承
Object Platform::Object IInspectable FileActivatedEventArgs
属性
実装

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

Application オブジェクトの OnFileActivated イベント ハンドラーは、すべてのファイルアクティブ化イベントを受け取ります。

protected override void OnFileActivated(FileActivatedEventArgs args)
{
       // TODO: Handle file activation

       // The number of files received is args.Files.Size
       // The first file is args.Files[0].Name
}
Private Sub OnFileActivated(ByVal args As Windows.ApplicationModel.Activation.FileActivatedEventArgs)
      ' TODO: Handle file activation

      ' The number of files received is args.Files.Size
      ' The first file is args.Files(0).Name
End Sub
void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs const& /* args */)
{
    // TODO: Handle file activation.

    // The number of files received is args.Files().Size().
    // The first file is args.Files().GetAt(0).Name().
}
void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs^ args)
{
       // TODO: Handle file activation

       // The number of files received is args->Files->Size
       // The first file is args->Files->GetAt(0)->Name
}

注釈

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

C++、C#、または Visual Basic を使用する UWP アプリでは、通常 、Application オブジェクトのメソッドをオーバーライドしてアクティブ化ポイントを実装します。 既定のテンプレート app.xaml 分離コード ファイルには常に OnLaunched のオーバーライドが含まれますが、 OnFileActivated などの他のアクティブ化ポイントのオーバーライドの定義は、アプリ コードに依存します。

アクティブ化シナリオに関連するすべての アプリケーション オーバーライドは、実装で Window.Activate を呼び出す必要があります。

ファイル コントラクトに対してアプリがアクティブ化されている場合は、Files プロパティを介してアプリに渡される StorageFile オブジェクトを使用してデータにアクセスする必要があることに注意してください。 アプリにファイルの場所へのアクセス許可がない可能性があるため、ファイルのパスにアクセスしないでください。

バージョン履歴

Windows のバージョン SDK バージョン 追加された値
1607 14393 ユーザー

プロパティ

CallerPackageFamilyName

アプリを起動したアプリのパッケージ ファミリ名。

CurrentlyShownApplicationViewId

現在表示されているアプリ ビューの識別子を取得します。

Files

アプリがアクティブ化されたファイルを取得します。

Kind

アクティブ化の種類を取得します。

NeighboringFilesQuery

アプリがアクティブ化されたファイルの近隣ファイルを取得します。

PreviousExecutionState

アクティブ化される前のアプリの実行状態を取得します。

SplashScreen

スプラッシュ スクリーンからアクティブ化されたアプリへの切り替えに関する情報を提供するスプラッシュ スクリーン オブジェクトを取得します。

User

アプリがアクティブ化されたユーザーを取得します。

Verb

アクティブ化されたファイルに関連付けられているアクションを取得します。

ViewSwitcher

アプリケーションのビューを設定できる オブジェクトを提供します。

適用対象

こちらもご覧ください