Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9749

UWPコンソールC#アプリからトースト通知を送信する。

$
0
0
はじめに UWP コンソールC#アプリから指定の時間にトースト通知させようと考え、 UWPアプリからトースト通知する方法を調べ、実装しました。 環境 Windows 11 Pro Visual Studio 2017 Express 設定 コンソールアプリからWinRTのトースト通知を利用するためにNuGetからMicrosoft.UWP.Notificationsをインストールします。 プログラムコード static void Main(string[] args) { var type = ToastTemplateType.ToastText01; var content = ToastNotificationManager.GetTemplateContent(type); var text = content.GetElementsByTagName("text").First(); text.AppendChild(content.CreateTextNode("一休み")); var notifier = ToastNotificationManager.CreateToastNotifier("通知"); notifier.Show(new ToastNotification(content)); } 結果 うまくでました。 参照

Viewing all articles
Browse latest Browse all 9749

Trending Articles