久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

是否可以從控制臺應用程序發送 Toast 通知?

Is it possible to send Toast notification from console application?(是否可以從控制臺應用程序發送 Toast 通知?)
本文介紹了是否可以從控制臺應用程序發送 Toast 通知?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

是否可以使用 ToastNotificationManager 從控制臺應用程序發送 Toast 通知?

Is it possible to send Toast notifications from console application using ToastNotificationManager ?

我知道可以從 Windows 通用應用程序發送 Toast 通知:

I know that it is possible to send Toast notifications from Windows Universal app:

var toast = new ToastNotification(doc);
ToastNotificationManager.CreateToastNotifier().Show(toast);

*doc - Toast 存儲在 XML 字符串中

*doc - Toast stored in XML string

要使用 ToastNotificaionManager,我需要在控制臺應用程序項目中無法引用的 Windows.UI.Notifications 庫.

To use ToastNotificaionManager I need Windows.UI.Notifications library which I can't reference in console application project.

我之前提到的庫實際上是由 WinRT 使用的.是否可以在 Windows 控制臺應用程序中使用 WinRT API?

The library I mentionet before is actualy used by WinRT. Is it possible to use WinRT APIs in Windows console application ?

推薦答案

首先你需要聲明你的程序將使用 winRT 庫:

At first you need to declare that your program will be using winRT libraries:

  1. 右鍵單擊您的項目,選擇卸載項目
  2. 右鍵單擊您的項目(不可用),然后單擊編輯 yourProject.csproj
  3. 添加新的屬性組:8.0
  4. 重新加載項目
  5. Windows > Core
    添加參考 Windows

現在您需要添加此代碼:

Now you need to add this code:

using Windows.UI.Notifications;

您將能夠使用此代碼發送通知:

and you will be able to send notifications using this code:

var toast = new ToastNotification(doc);
ToastNotificationManager.CreateToastNotifier().Show(toast);

參考:如何從 C# 桌面應用程序調用 Windows 8 中的 WinRT API - WinRT 圖

這篇關于是否可以從控制臺應用程序發送 Toast 通知?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

LINQ to SQL and Concurrency Issues(LINQ to SQL 和并發問題)
Yield return from a try/catch block(try/catch 塊的收益回報)
Should I call Parameters.Clear when reusing a SqlCommand with a transation?(重用帶有事務的 SqlCommand 時,我應該調用 Parameters.Clear 嗎?)
what does a using statement without variable do when disposing?(處理時不帶變量的 using 語句有什么作用?)
Why doesn#39;t TransactionScope work with Entity Framework?(為什么 TransactionScope 不適用于實體框架?)
How to dispose TransactionScope in cancelable async/await?(如何在可取消的 async/await 中處理 TransactionScope?)
主站蜘蛛池模板: 亚洲天堂男人天堂 | 精品婷婷| 久草精品视频在线看网站免费 | 天天躁日日躁bbbbb | 亚洲综合精品 | 欧美亚洲一区二区三区 | 久久99热这里只频精品6学生 | 日韩国产一区二区 | 久久精品一区二区三区四区五区 | 黄色一级视频网站 | 色77777 | www性 | 欧美爱爱网站 | 青娱乐99| 日韩在线不卡 | 亚洲国产精品久久久 | 日韩在线免费观看视频 | 日本三级大片 | 黄色片小视频 | 日韩 欧美 | 午夜国产在线观看 | 法国极品成人h版 | 久久免费观看视频 | 一区二区三区四区国产 | 久操精品视频 | 五月天一区二区 | 久久久久亚洲精品 | 中文字幕高清在线 | 伊人网在线播放 | 亚洲一区二区三区在线 | 国 产 黄 色 大 片 | 国产成人小视频 | 亚洲精品久久久蜜桃 | 亚洲第一黄网 | 成人在线视频网 | 亚洲精品小视频 | 亚洲久久久 | 日本熟妇毛耸耸xxxxxx | 日韩黄网 | 人与拘一级a毛片 | 性色av一区二区 |