Table of Contents

NotificationContent 类

命名空间
ClassIsland.Core.Models.Notification
程序集
ClassIsland.Core.dll

代表一个提醒中的一部分内容。

public class NotificationContent : ObservableRecipient, INotifyPropertyChanged, INotifyPropertyChanging
继承
NotificationContent
实现
继承成员

构造函数

NotificationContent()

初始化一个 NotificationContent 对象

public NotificationContent()

NotificationContent(object?)

初始化一个 NotificationContent 对象

public NotificationContent(object? content)

参数

content object

提醒内容对象

字段

Empty

代表空内容

public static readonly NotificationContent Empty

字段值

NotificationContent

属性

Content

提醒内容。

public object? Content { get; set; }

属性值

object

ContentTemplate

提醒内容模板,可选。如果此值不为 null,将在呈现提醒内容 Content 时使用。

public DataTemplate? ContentTemplate { get; set; }

属性值

DataTemplate

备注

即使不设置此属性,ContentPresenter 也会根据设置的数据类型选择资源中对应的数据模板进行呈现。

Duration

此部分的显示时长。当 EndTime 不为 null 时,此项不起作用。

public TimeSpan Duration { get; set; }

属性值

TimeSpan

EndTime

此部分显示的结束时间。

public DateTime? EndTime { get; set; }

属性值

DateTime?

IsSpeechEnabled

显示此部分的提醒时是否启用语音。

public bool IsSpeechEnabled { get; set; }

属性值

bool

SpeechContent

显示此部分提醒时的语音内容。

public string SpeechContent { get; set; }

属性值

string

方法

CreateRollingTextContent(string, TimeSpan?, int, Action<NotificationContent>?)

从模板创建滚动文本内容。

public static NotificationContent CreateRollingTextContent(string text, TimeSpan? duration = null, int repeatCount = 2, Action<NotificationContent>? factory = null)

参数

text string

文本

duration TimeSpan?

提醒显示时长

repeatCount int

滚动重复次数

factory Action<NotificationContent>

提醒内容处理工厂

返回

NotificationContent

提醒内容 NotificationContent 对象

CreateSimpleTextContent(string, Action<NotificationContent>?)

从模板创建简单文本内容。

public static NotificationContent CreateSimpleTextContent(string text, Action<NotificationContent>? factory = null)

参数

text string

文本

factory Action<NotificationContent>

提醒内容处理工厂

返回

NotificationContent

提醒内容 NotificationContent 对象

CreateTwoIconsMask(string, PackIconKind, PackIconKind, bool, Action<NotificationContent>?)

从模板创建双图标提醒遮罩内容。

public static NotificationContent CreateTwoIconsMask(string text, PackIconKind leftIcon = PackIconKind.AlertCircleOutline, PackIconKind rightIcon = PackIconKind.BellRing, bool hasRightIcon = true, Action<NotificationContent>? factory = null)

参数

text string

遮罩文本

leftIcon PackIconKind

左侧图标

rightIcon PackIconKind

右侧图标

hasRightIcon bool

是否拥有右侧图标

factory Action<NotificationContent>

提醒内容处理工厂

返回

NotificationContent

提醒内容 NotificationContent 对象