共用方式為


BadgeUpdater.Update(BadgeNotification) 方法

定義

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

public:
 virtual void Update(BadgeNotification ^ notification) = Update;
void Update(BadgeNotification const& notification);
public void Update(BadgeNotification notification);
function update(notification)
Public Sub Update (notification As BadgeNotification)

參數

notification
BadgeNotification

物件,提供徽章的新 XML 定義。

範例

下列範例示範如何使用 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);
}

適用於

另請參閱