BackgroundTaskBuilder 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表一個需要向系統註冊的背景任務。
public ref class BackgroundTaskBuilder sealed
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BackgroundTaskBuilder final
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.ApplicationModel.Background.BackgroundTaskContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BackgroundTaskBuilder
function BackgroundTaskBuilder()
Public NotInheritable Class BackgroundTaskBuilder
- 繼承
- 屬性
備註
關於將帶有背景任務的 UWP 應用程式遷移到 WinUI 3 的資訊,請參閱 Windows 應用程式 SDK 背景任務遷移策略指南。
這個類別不是敏捷的,所以你需要考慮它的執行緒模型和編組行為。 欲了解更多資訊,請參閱 C++/WinRT 中的敏捷物件、執行緒與編組(C++/CX)及多執行緒環境中使用 Windows 執行階段 物件(.NET)。
Note
在內部, BackgroundTaskBuilder 使用 ApplicationData.LocalSettings 來儲存背景任務註冊資訊,因此清理 LocalSettings 容器可能會影響先前已註冊背景任務的功能。 欲了解更多本地設定資訊,請參閱 「儲存與取回設定」及其他應用程式資料。
建構函式
| 名稱 | Description |
|---|---|
| BackgroundTaskBuilder() |
建立一個新的 BackgroundTaskBuilder 物件。 |
屬性
| 名稱 | Description |
|---|---|
| Name |
取得或設定背景任務名稱。 |
| TaskGroup |
取得並設定群組識別碼,以便獨立維護背景任務註冊。 |
方法
| 名稱 | Description |
|---|---|
| AddCondition(IBackgroundCondition) |
為背景任務加一個條件。 |
| Register() |
向系統註冊背景任務。 |
| Register(String) |
向系統註冊背景任務。 |
| SetTaskEntryPointClsid(Guid) |
利用現有 的 BackgroundTaskBuilder 物件,為背景任務指派一個 COM CLSID 入口點。 |
| SetTrigger(IBackgroundTrigger) |
設定背景任務的事件觸發條件。 |