IBackgroundTaskInstance2 介面

定義

提供背景工作實例的存取權。 繼承自 IBackgroundTaskInstance 介面,並新增 GetThrottleCount 方法。

public interface class IBackgroundTaskInstance2 : IBackgroundTaskInstance
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(1333592438, 3190, 20404, 137, 109, 93, 225, 134, 65, 34, 246)]
struct IBackgroundTaskInstance2 : IBackgroundTaskInstance
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(1333592438, 3190, 20404, 137, 109, 93, 225, 134, 65, 34, 246)]
public interface IBackgroundTaskInstance2 : IBackgroundTaskInstance
Public Interface IBackgroundTaskInstance2
Implements IBackgroundTaskInstance
屬性
實作

Windows 需求

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

屬性

InstanceId

取得背景工作實例的實例識別碼。

(繼承來源 IBackgroundTaskInstance)
Progress

取得或設定背景工作實例的進度狀態。

(繼承來源 IBackgroundTaskInstance)
SuspendedCount

取得導致背景工作暫停的資源管理原則次數。

(繼承來源 IBackgroundTaskInstance)
Task

取得這個背景工作實例之已註冊背景工作的存取權。

(繼承來源 IBackgroundTaskInstance)
TriggerDetails

取得與背景工作實例相關聯的其他資訊。

(繼承來源 IBackgroundTaskInstance)

方法

GetDeferral()

通知系統,背景工作可能會在 IBackgroundTask.Run 方法傳回之後繼續執行工作。

(繼承來源 IBackgroundTaskInstance)
GetThrottleCount(BackgroundTaskThrottleCounter)

擷取背景工作已暫停使用太多資源的次數。

事件

Canceled

將取消事件處理常式附加至背景工作實例。

對於 Windows Phone 8.x 應用程式,如果裝置記憶體不足,背景工作可能會在沒有警告的情況下終止,而不會引發 OnCanceled 事件。 這有助於確保前景應用程式的使用者體驗。 您的背景工作應該要設計成能夠處理這種情況。 請注意,這只適用于Windows Phone。

(繼承來源 IBackgroundTaskInstance)

適用於

另請參閱