語言

FileOpenPickerActivatedEventArgs 類別

定義

提供使用者嘗試挑選應用程式所提供之檔案或資料夾時所引發之啟動事件的相關資訊。

JAVAscript 此類型會顯示為 WebUIFileOpenPickerActivatedEventArgs。

public ref class FileOpenPickerActivatedEventArgs sealed : IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
public ref class FileOpenPickerActivatedEventArgs sealed : IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileOpenPickerActivatedEventArgs final : IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileOpenPickerActivatedEventArgs final : IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileOpenPickerActivatedEventArgs : IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileOpenPickerActivatedEventArgs : IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
Public NotInheritable Class FileOpenPickerActivatedEventArgs
Implements IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
Public NotInheritable Class FileOpenPickerActivatedEventArgs
Implements IActivatedEventArgsWithUser, IFileOpenPickerActivatedEventArgs, IFileOpenPickerActivatedEventArgs2
繼承
Object Platform::Object IInspectable FileOpenPickerActivatedEventArgs
屬性
實作

Windows 需求

規格需求 Description
裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

檔案選擇器合約範例示範如何回應FileOpenPicker啟用點。

// File open picker activated event handler
protected override void OnFileOpenPickerActivated(FileOpenPickerActivatedEventArgs args)
{
    var FileOpenPickerPage = new SDKTemplate.FileOpenPickerPage();
    FileOpenPickerPage.Activate(args);
}

// Overloaded method to respond to fileOpenPicker events
public void Activate(FileOpenPickerActivatedEventArgs args)
{
    // Perform tasks to prepare your app to display its file picker page

    // Get file picker UI
    fileOpenPickerUI = args.FileOpenPickerUI;

    Window.Current.Content = this;
    this.OnNavigatedTo(null);
    Window.Current.Activate();
}

針對 C#, args 針對 OnFileOpenPickerActivated 覆寫會參考 FileOpenPickerActivatedEventArgs 物件。 OnFileOpenPickerActivated覆寫位於 App.xaml.cs 檔案中,而 Activate 方法位於檔案選擇器合約範例的 FileOpenPickerPage.xaml.cs 檔案中。

備註

瞭解如何在快速入門:透過Windows.Storage.Pickers.Provider命名空間參考中提供檔案服務,讓使用者從您的應用程式挑選檔案。

當使用者想要挑選應用程式所提供的檔案或資料夾時,FileOpenPickerActivatedEventArgs 物件會傳遞至應用程式的啟動事件處理常式。 這種類型的啟用是由Kind屬性所傳回的ActivationKind.FileOpenPicker值所表示。

以 JavaScript 撰寫的應用程式必須接聽並處理 Windows.UI.WebUI.webUIApplication.activated 事件。

使用 C++、C# 或 Visual Basic 的 UWP 應用程式通常會透過覆寫 Application 物件的方法來實作啟用點。 預設範本 app.xaml 程式碼後置檔案一律會包含 OnLaunched的覆寫,但定義其他啟用點的覆寫,例如 OnFileOpenPickerActivated ,取決於您的應用程式程式碼。

啟用案例中涉及的所有 應用程式 覆寫都應該在其實作中呼叫 Window.Activate 。

版本歷程記錄

Windows 版本 SDK 版本 已新增值
1607 14393 User

屬性

名稱 Description
CallerPackageFamilyName

啟動應用程式之應用程式的套件系列名稱。

FileOpenPickerUI

取得當使用者想要挑選應用程式提供之檔案或資料夾時,所顯示之檔案選擇器的信件箱 UI。

Kind

取得啟用類型。

PreviousExecutionState

取得應用程式啟動前的執行狀態。

SplashScreen

取得 SplashScreen 物件,提供從啟動顯示畫面轉換至啟動應用程式的相關資訊。

User

取得啟動應用程式的使用者。

適用於

另請參閱