简体   繁体   English

最小化系统托盘的含义

[英]Implications of Minimizing to System Tray

I have an UI application that serves several functions (<800KB). 我有一个提供多种功能(<800KB)的UI应用程序。 I wanted to allow minimizing it to the system tray, and continue to decode data coming from the serial port and sending network messages. 我希望将其最小化到系统托盘,并继续解码来自串行端口的数据并发送网络消息。

Can I simply hide the main form and create a NotifyIcon in the system tray, or are there other considerations for system tray applications? 我可以简单地隐藏主窗体并在系统托盘中创建NotifyIcon,还是对系统托盘应用程序有其他考虑? Does the application use less resources while hidden? 应用程序在隐藏时是否使用较少的资源? Or is it best to make a light version of the application for the system tray (with duplication of code)? 还是最好为系统托盘制作一个简短的应用程序版本(重复代码)?

My application does what 2 different applications do (related functions). 我的应用程序执行2种不同的应用程序所做的事情(相关功能)。 I'm trying to foresee the implications before I finish coding it. 我试图在完成编码之前预言其中的含义。

I've written a couple apps that use NotifyIcon. 我编写了一些使用NotifyIcon的应用程序。 Putting it in the notification area (system tray) isn't anything special. 将其放在通知区域(系统托盘)中没什么特别的。 It's just not visible on the toolbar anymore. 只是在工具栏上不再可见。

IMO best way in your case is to make windows service that will decode data from serial port and send messages. IMO最好的方法是使Windows服务能够从串行端口解码数据并发送消息。 And other winforms app that will only set preferences and watch service state, that one can go to tray. 和其他只能设置首选项并查看服务状态的winforms应用程序一样,可以进入任务栏。 Maybe you don't really need this tray app, just windows service, you can set preferences trough config file and watch state trough EventLog. 也许您实际上并不需要此托盘应用程序,仅需要Windows服务,就可以通过配置文件设置首选项,并通过EventLog监视状态。

Of course if is possible to run from windows service, eg. 当然,如果可以从Windows服务运行,例如。 your serial port and network code doesn't need logged user or desktop. 您的串行端口和网络代码不需要登录的用户或桌面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM