BadgeUpdater 類別

定義

更新更新程式所系結之特定磚上的徽章重迭。

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

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

下列範例示範如何使用 Update 將數值徽章更新傳送至呼叫應用程式的磚。

function sendBadgeNotification() {
    var Notifications = Windows.UI.Notifications;
    var badgeXml;
    var badgeAttributes;

    // Get an XML DOM version of a specific template by using getTemplateContent.
    badgeXml = Notifications.BadgeUpdateManager.getTemplateContent(Notifications.BadgeTemplateType.badgeNumber);
    badgeAttributes = badgeXml.getElementsByTagName("badge");
    badgeAttributes[0].setAttribute("value", "7");

    // Create a badge notification from the XML content.
    var badgeNotification = new Notifications.BadgeNotification(badgeXml);

    // Send the badge notification to the app's tile.
    Notifications.BadgeUpdateManager.createBadgeUpdaterForApplication().update(badgeNotification);
}

備註

若要取得這個物件的實例,請呼叫 BadgeUpdateManager.CreateBadgeUpdaterForApplicationBadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile 方法。

建立時,BadgeUpdater 會系結至特定的應用程式或次要磚,因此此類別的方法只會影響物件實例所系結的單一磚。

方法

Clear()

從更新程式所系結的圖格中移除徽章。

StartPeriodicUpdate(Uri, DateTime, PeriodicUpdateRecurrence)

從更新程式所系結的 Web 資源開始進行徽章的一系列計時更新。 更新指定時間開始。 請注意,定期更新中只允許 (HTTP/HTTPs) 的 Web 資源。

StartPeriodicUpdate(Uri, PeriodicUpdateRecurrence)

從更新程式所系結的 Web 資源開始一系列的計時更新,立即開始。 請注意,定期更新中只允許 (HTTP/HTTPs) 的 Web 資源。

StopPeriodicUpdate()

取消更新程式所系結徽章的目前時間更新序列。

Update(BadgeNotification)

將變更套用至徽章的字元或數位。

適用於

另請參閱