久久久久久久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?)
主站蜘蛛池模板: 日韩高清www| 国产一区二 | 嫩草视频在线看 | av先锋资源 | 日本福利在线观看 | 国产农村妇女毛片精品久久麻豆 | www狠狠干| 91麻豆产精品久久久久久 | 色资源在线观看 | 在线视频a | 亚洲精品日韩欧美 | 国产免费视频 | 日干夜操 | 欧美2区 | 精品国产乱码久久久久久88av | av日韩高清| caoporn视频| 日日操日日舔 | 国产精品中文字幕一区二区三区 | 7777精品伊人久久精品影视 | 亚洲一区二区在线 | 午夜资源| 国产高清av免费观看 | 日韩欧美国产成人一区二区 | 国产精品一区二区在线 | 欧美中文字幕在线观看 | 一级大黄| 精品亚洲一区二区 | av在线一区二区三区 | 在线精品亚洲欧美日韩国产 | 精品久久亚洲 | 国产1区 | 看毛片网站 | 日韩视频观看 | 国产不卡一区在线观看 | 日韩精品久久久久 | 亚洲人精品午夜 | 国产三区在线观看视频 | 日韩精品一区二区三区在线观看 | 色婷婷av久久久久久久 | 亚洲福利一区二区 |