BadgeNotification 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
public ref class BadgeNotification sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IBadgeNotificationFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class BadgeNotification 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.IBadgeNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class BadgeNotification 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.IBadgeNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class BadgeNotification final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IBadgeNotificationFactory), 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 BadgeNotification
[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.IBadgeNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class BadgeNotification
[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.IBadgeNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class BadgeNotification
function BadgeNotification(content)
Public NotInheritable Class BadgeNotification
- 继承
- 属性
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 中引入)
|
示例
以下示例代码使用 BadgeNotification 方法创建数字锁屏提醒通知。 如果使用此方法将值设置为“0”,则会清除锁屏提醒。
var Notifications = Windows.UI.Notifications;
var badgeXml = Notifications.BadgeUpdateManager.getTemplateContent(Notifications.BadgeTemplateType.badgeNumber);
var badgeAttributes = badgeXml.getElementsByTagName("badge");
badgeAttributes[0].setAttribute("value", "26");
// Create a badge notification from XML
var badgeNotification = new Notifications.badgeNotification(badgeXml);
以下示例代码使用 BadgeNotification 方法创建字形锁屏提醒通知。 如果使用此方法将值设置为“none”,则会清除锁屏提醒。
var Notifications = Windows.UI.Notifications;
var badgeXml = Notifications.BadgeUpdateManager.getTemplateContent(Notifications.BadgeTemplateType.badgeNumber);
var badgeAttributes = badgeXml.getElementsByTagName("badge");
badgeAttributes[0].setAttribute("value", "alert");
// Create a badge notification from XML
var badgeNotification = new Notifications.badgeNotification(badgeXml);
构造函数
BadgeNotification(XmlDocument) |
创建并初始化 BadgeNotification 的新实例。 |
属性
Content |
获取定义用作磁贴锁屏提醒的值或字形的 XML。 |
ExpirationTime |
获取或设置 Windows 从磁贴中删除锁屏提醒的时间。 默认情况下,本地锁屏提醒通知不会过期,推送、定期和计划的锁屏提醒通知会在三天后过期。 最佳做法是显式设置过期时间以避免过时的内容。 |