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

如何顯示來自 Windows 服務的通知區域氣球和圖標

How can I show a Notification Area Balloon and Icon from a Windows Service?(如何顯示來自 Windows 服務的通知區域氣球和圖標?)
本文介紹了如何顯示來自 Windows 服務的通知區域氣球和圖標?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 Windows 服務,當用戶啟動他們的工作站時它總是在運行.此 Windows 服務很關鍵,我想在發生某些事情(例如服務停止、啟動、重新啟動等)時在通知區域顯示氣球通知.

I have a Windows Service that is always running when the user starts their workstation. This Windows Service is critical and I would like to show a Balloon Notification in the Notification Area when certain things happen such as the Service Stops, Starts, Restarts etc.

例如:

另外,有沒有辦法為我的 Windows 服務顯示通知區域圖標?

Also, is there a way to show a Notification Area Icon for my Windows Service?

推薦答案

Windows 服務直接與桌面交互的時代已經結束,因此您必須尋找另一種方式.

The days of Windows services interacting directly with the desktop are over, so you have to find another way.

我所做的是創建一個包含 NotifyIcon 的普通 WinForms 應用程序.此應用程序的行為模仿任務管理器的行為,因此它可以從任務欄中隱藏,并且只能在系統托盤中可見.如果我右鍵單擊系統托盤圖標,我會看到一個菜單.如果我雙擊該圖標,則會顯示應用程序窗口.

What I have done is create a normal WinForms application that includes a NotifyIcon. The behavior of this application mimics that of Task Manager, such that it can be hidden from the task bar and only visible in the system tray. If I right-click the system tray icon, I get a menu. If I double-click the icon, the application window is shown.

為了方便WinForms應用程序和Windows服務之間的通信,我使用了WCF.具體來說,我使用 Juval Lowy 的 發布訂閱框架,它非常適合這種場景.查看我的回答此處了解更多信息詳情.

To facilitate the communication between the WinForms application and the Windows service, I use WCF. Specifically, I use Juval Lowy's Publish-Subscribe Framework, which works really well for this kind of scenario. See my answer here for more details.

希望這會有所幫助.

這篇關于如何顯示來自 Windows 服務的通知區域氣球和圖標?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)
主站蜘蛛池模板: 成人在线网址 | 日一区二区 | 在线一区视频 | 国产一区二区三区在线看 | 一区二区三区在线电影 | 一级看片免费视频 | 午夜视频一区 | 99精品在线观看 | 男人的天堂久久 | 日韩www| 91亚洲国产 | 国产精品久久久久久久岛一牛影视 | 一区二区日韩 | 亚洲欧美综合精品另类天天更新 | 久久国产精品免费一区二区三区 | 国产精品毛片一区二区三区 | 国产99久久精品一区二区永久免费 | 亚洲男女视频在线观看 | 久久久精品久久 | 欧美精品久久久久久久久久 | 国产高清视频在线 | 亚洲国产成人精品女人久久久 | 日本不卡视频 | 国产精品久久久久婷婷二区次 | 黄色片在线观看网址 | 日韩精品在线免费观看视频 | 欧美aaaa视频 | 日本韩国电影免费观看 | 亚洲欧美一区二区三区情侣bbw | 日韩精品极品视频在线观看免费 | 91av在线免费观看 | 成人在线免费观看视频 | 黄色综合 | 亚洲不卡在线观看 | 欧美在线一级 | 精品亚洲二区 | 欧美精品一区二区三区在线 | 少妇无套高潮一二三区 | 男女性毛片| 男人天堂网址 | 免费人成激情视频在线观看冫 |