TileUpdater 類別

定義

變更更新程式所系結之特定磚的內容。

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

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 sendTileTextNotification() {
    var Notifications = Windows.UI.Notifications;

    // Get an XML DOM version of a specific template by using getTemplateContent.
    var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text03);

    // You will need to look at the template documentation to know how many text fields a particular template has.
    // Get the text attribute for this template and fill it in.
    var tileAttributes = tileXml.getElementsByTagName("text");
    tileAttributes[0].appendChild(tileXml.createTextNode("Hello World!"));

    // Create the notification from the XML.
    var tileNotification = new Notifications.TileNotification(tileXml);

    // Send the notification to the calling app's tile.
    Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification);
}

下列程式程式碼使用 EnableNotificationQueue 來啟用呼叫應用程式磚的通知佇列。

Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().enableNotificationQueue(true);

下列範例顯示 RemoveFromSchedule 方法的使用方式。

var notifier = Notifications.TileUpdateManager.createTileUpdaterForApplication();
var scheduled = notifier.getScheduledTileNotifications();

for (var i = 0, len = scheduled.length; i < len; i++) {

    // The itemId value is the unique ScheduledTileNotification.Id assigned to the 
    // notification when it was created.
    if (scheduled[i].id === itemId) {
        notifier.removeFromSchedule(scheduled[i]);
    }
}

備註

若要取得這個物件的實例,請呼叫 TileUpdateManager.CreateTileUpdaterForApplicationTileUpdateManager.CreateTileUpdaterForSecondaryTile 方法。

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

屬性

Setting

取得值,指定是否可以透過通知更新磚。

方法

AddToSchedule(ScheduledTileNotification)

ScheduledTileNotification 新增 至排程。

Clear()

移除所有更新,並讓磚顯示其預設內容,如應用程式資訊清單中所宣告。

EnableNotificationQueue(Boolean)

可讓磚排入最多五個通知的佇列。 這會在所有磚大小上啟用通知佇列。

EnableNotificationQueueForSquare150x150(Boolean)

可讓磚排入媒體磚上最多五個通知的佇列。

EnableNotificationQueueForSquare310x310(Boolean)

可讓磚排入大型磚上最多五個通知的佇列。

EnableNotificationQueueForWide310x150(Boolean)

可讓磚排入寬磚上最多五個通知的佇列。

GetScheduledTileNotifications()

擷取磚的排程更新清單。

RemoveFromSchedule(ScheduledTileNotification)

從排程中移除即將推出的磚更新。

StartPeriodicUpdate(Uri, DateTime, PeriodicUpdateRecurrence)

開始更新程式所系結之磚的一系列計時更新。 更新內容是從指定的統一資源識別項 (URI) 擷取。 更新指定時間開始。

StartPeriodicUpdate(Uri, PeriodicUpdateRecurrence)

開始更新程式所系結之磚的一系列計時內容變更,立即開始。

StartPeriodicUpdateBatch(IIterable<Uri>, DateTime, PeriodicUpdateRecurrence)

開始在更新程式所系結之磚上迴圈的一系列計時更新。 更新內容會從指定的統一資源識別項陣列擷取, (URI) ,並在指定時間之後于定期間隔發生後續更新。

注意

若要使用此功能,您必須先呼叫 EnableNotificationQueue來啟用磚的通知佇列。

StartPeriodicUpdateBatch(IIterable<Uri>, PeriodicUpdateRecurrence)

開始在更新程式所系結之磚上迴圈的一系列計時更新。 更新內容是從指定的統一資源識別項陣列擷取 (URI) ,第一次更新會立即發生,後續更新會在後續定期發生。

注意

若要使用此功能,您必須先呼叫 EnableNotificationQueue來啟用磚的通知佇列。

StopPeriodicUpdate()

取消更新程式所系結之磚的目前計時更新序列。

Update(TileNotification)

將內容或外觀的變更套用至磚。

適用於