如何制作一个具有任务托盘图标的Windows服务来管理它? [英] How to make a windows service that has a task tray icon for managing it?

查看:55
本文介绍了如何制作一个具有任务托盘图标的Windows服务来管理它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计们,

我熟悉编写Windows服务应用程序。我已经使用各种方法编写了一些 - 第三方库,.NET提供的方法等。但我以前的应用程序都没有任何方式与它们进行交互。

I'm familiar with writing windows service applications. I've written a few using various approaches - third party libs, the .NET-provided approach, etc. None of my prior applications had any way to interact with them, though.

I我现在需要编写一个Windows服务应用程序,但它需要一个任务托盘图标,可能会带来一个"管理GUI"。当你点击它时。

I'm needing now to write a windows service application, but it will need a task tray icon that perhaps brings up a "management GUI" when you click on it.

执行此操作的适当模式是什么?

What is the appropriate pattern for doing this?

该服务应该是自己的应用程序,但是能够通过外部手段进行交互 - 也许是一个轮询配置更改的数据库?它应该使用IPC还是其他东西?

Should the service be its own application, but is able to be interacted with through external means - perhaps a database that it polls for config changes? Should it use IPC or something?

有没有办法让Windows服务也有一个GUI,以便管理GUI和服务都是同一个应用程序?

Is there a way to make a windows service also have a GUI so that the management GUI and the service are all just the same application?

我真的不知道,我正在做初步研究,以确定最佳路线。

I really don't know, and am doing initial research to determine the best route to go with this.

谢谢!

推荐答案

Windows服务可以有GUI。

A Windows service can have a GUI.

这取决于您希望服务的运行方式。例如,如果您需要在用户注销时继续运行该服务,那么您将无法使用任何类型的GUI。通常就是这种情况。

It depends on how you want your service to run. For example, if you need the service to continue running while the user is logged out then you can't have any kind of GUI. This is usually the case.

典型的模式是拥有两个应用程序。第一个是服务,第二个是仪表板。仪表板是一个表单应用程序,允许服务管理员根据需要进行更改。如上所述,可以重新启动服务或进行轮询。由于
可以从仪表板重新启动服务,因此这是可取的,除非您绝对需要始终保持服务。如果是这种情况,那么轮询就是理智的做法。 Saga

A typical pattern is to have two apps. The first is the service and the second is the dashboard. The dashboard is a forms app that allows the service admin to make changes as needed. The service can either be restarted or have it poll as you mentioned. Since restarting the service can be done from the dashboard, this is preferable, unless you absolutely need the service to be always up. If this is the case then polling is the sane way to do it. Saga


这篇关于如何制作一个具有任务托盘图标的Windows服务来管理它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆