LinuxIntegration.Notifications
1.0.0
기본 Linux 데스크탑 알림
표준 DotNet 빌드 프로세스, dotnet build
Nuget https://www.nuget.org/packages/rbnswartz.linuxintegration.notifications/ 에서이 패키지를 설치할 수 있습니다.
NotificationManager의 인스턴스를 작성하고 shownotificationAsync를 호출하십시오
NotificationManager manager = new NotificationManager ( "test app" ) ;
var summary = "This is a summary" ;
var body = "This is the body of the notification" ;
await manager . ShowNotificationAsync ( summary , body , expiration : 5000 ) ;알림을 생성 한 다음 HidenotificationAsync를 호출 할 때 반환 된 ID를 가져옵니다.
NotificationManager manager = new NotificationManager ( "test app" ) ;
var summary = "This is a summary" ;
var body = "This is the body of the notification" ;
var id = await manager . ShowNotificationAsync ( summary , body , expiration : 5000 ) ;
await manager . HideNotificationAsync ( id ) ;알림 시스템이 지원하는 경우 사용자 정의 작업을 알림에 추가 할 수 있습니다.
NotificationManager의 SupportSamctions 속성을보고 지원되는지 확인할 수 있습니다.
조치가 지원되면 이와 같이 사용할 수 있습니다. 사전의 키는 표시된 값이며 값은 작업을 클릭 할 때 호출되는 조치입니다.
NotificationManager manager = new NotificationManager ( "test app" ) ;
var summary = "This is a summary" ;
var body = "This is the body of the notification" ;
var notificationId = await manager . ShowNotificationAsync ( summary , body , actions : new Dictionary < string , Action > ( )
{
[ "Press me" ] = ( ) => Console . WriteLine ( "Press me action called" ) ,
[ "Do other important thing" ] = ( ) => Console . WriteLine ( "Other important thing" )
} ,
expiration : 5000 ) ;