Bagikan melalui


TileNotification Kelas

Definisi

Menentukan pembaruan ke petak peta, termasuk visual, tag identifikasi, dan waktu kedaluwarsanya.

public ref class TileNotification sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.ITileNotificationFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class TileNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.ITileNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class TileNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.ITileNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class TileNotification final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.ITileNotificationFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class TileNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.ITileNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class TileNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.ITileNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class TileNotification
function TileNotification(content)
Public NotInheritable Class TileNotification
Warisan
Object Platform::Object IInspectable TileNotification
Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10 (diperkenalkan dalam 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v1.0)

Contoh

Contoh berikut menggunakan konstruktor TileNotification untuk membuat instans baru, lalu menggunakan properti ExpirationTime untuk menampilkan pemberitahuan petak peta selama 30 detik.

function tileNotificationExpiration() {
    var Notifications = Windows.UI.Notifications;
    var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text04);

    var currentTime = new Date();
    var seconds = 30;

    var tileTextAttributes = tileXml.getElementsByTagName("text");
    tileTextAttributes[0].appendChild(tileXml.createTextNode("This notification will expire at " + new Date(currentTime.getTime() + seconds * 1000)));

    var tileNotification = new Notifications.TileNotification(tileXml);

    // Set the expiration time on the notification
    var expiryTime = new Date(currentTime.getTime() + seconds * 1000);

    tileNotification.expirationTime = expiryTime;
    Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification);
}

Konstruktor

TileNotification(XmlDocument)

Membuat dan menginisialisasi instans baru objek TileNotification untuk digunakan dengan TileUpdater.

Properti

Content

Mendapatkan deskripsi XML dari konten pemberitahuan, yang kemudian dapat Anda manipulasi untuk mengubah pemberitahuan.

ExpirationTime

Mendapatkan atau mengatur waktu Windows akan menghapus pemberitahuan dari petak peta. Secara default, pembaruan petak peta tidak kedaluwarsa. Ini adalah praktik terbaik untuk secara eksplisit mengatur waktu kedaluwarsa untuk menghindari konten kedaluwarsa.

Tag

Mendapatkan atau mengatur string yang dapat digunakan Windows untuk mencegah konten pemberitahuan duplikat muncul dalam antrean.

Berlaku untuk

Lihat juga