Table of Contents

NotificationProviderBase 类

命名空间
ClassIsland.Core.Abstractions.Services.NotificationProviders
程序集
ClassIsland.Core.dll

提醒提供方基类。

public abstract class NotificationProviderBase : INotificationProvider, INotificationSender, IHostedService
继承
NotificationProviderBase
实现
Derived
继承成员

构造函数

NotificationProviderBase()

初始化一个 NotificationProviderBase 类的新实例。

protected NotificationProviderBase()

NotificationProviderBase(bool)

初始化一个 NotificationProviderBase 类的新实例。

protected NotificationProviderBase(bool autoRegister)

参数

autoRegister bool

属性

Description

提醒提供方描述

public string Description { get; set; }

属性值

string

IconElement

提醒提供方图标元素,留空则代表使用默认图标。

public object? IconElement { get; set; }

属性值

object

Name

提醒提供方名称

public string Name { get; set; }

属性值

string

ProviderGuid

提醒提供方 GUID

public Guid ProviderGuid { get; set; }

属性值

Guid

SettingsElement

提醒提供方设置界面控件,将显示在【应用设置】->【提醒】中。留空则代表此提醒提供方没有设置界面。

public object? SettingsElement { get; set; }

属性值

object

方法

Channel(Guid)

获取指定的提醒渠道

protected NotificationChannel Channel(Guid id)

参数

id Guid

提醒渠道 GUID

返回

NotificationChannel

对应的提醒渠道 NotificationChannel

Channel(string)

获取指定的提醒渠道

protected NotificationChannel Channel(string id)

参数

id string

提醒渠道 GUID

返回

NotificationChannel

对应的提醒渠道 NotificationChannel

ShowChainedNotifications(params NotificationRequest[])

显示链式提醒。链式显示的提醒会按照传入的顺序显示,并且当其中一个提醒被取消时,所有后续的提醒都会被取消。

public void ShowChainedNotifications(params NotificationRequest[] requests)

参数

requests NotificationRequest[]

提醒请求

ShowChainedNotificationsAsync(NotificationRequest[])

显示链式提醒,并等待最后一个提醒显示完成。链式显示的提醒会按照传入的顺序显示,并且当其中一个提醒被取消时,所有后续的提醒都会被取消。

public Task ShowChainedNotificationsAsync(NotificationRequest[] requests)

参数

requests NotificationRequest[]

提醒请求

返回

Task

ShowNotification(NotificationRequest)

显示一个提醒。

public void ShowNotification(NotificationRequest request)

参数

request NotificationRequest

提醒请求

ShowNotificationAsync(NotificationRequest)

显示一个提醒,并等待提醒显示完成。

public Task ShowNotificationAsync(NotificationRequest request)

参数

request NotificationRequest

提醒请求

返回

Task

StartAsync(CancellationToken)

Triggered when the application host is ready to start the service.

public Task StartAsync(CancellationToken cancellationToken)

参数

cancellationToken CancellationToken

Indicates that the start process has been aborted.

返回

Task

A Task that represents the asynchronous Start operation.

StopAsync(CancellationToken)

Triggered when the application host is performing a graceful shutdown.

public Task StopAsync(CancellationToken cancellationToken)

参数

cancellationToken CancellationToken

Indicates that the shutdown process should no longer be graceful.

返回

Task

A Task that represents the asynchronous Stop operation.