C# Windows 窗体 GUI - 监视 Windows 启动

发布于 2024-10-23 00:57:36 字数 347 浏览 3 评论 0原文

我有一个 C# Windows 窗体交互式应用程序和相关的 C# Windows 服务。

在部署这些的特定计算机上,登录和应用程序启动是自动的。交互式应用程序始终在服务之前启动。该应用程序有一个状态指示器来显示它何时连接到服务,但这些机器速度很慢,我的服务需要 45-60 秒才能最终启动。在此期间,屏幕上没有任何反应。

我应该指出,我的服务启动很快......这是依赖(和其他)服务需要一些时间才能启动。

我希望在应用程序等待服务时显示 Windows 启动进度的某种指示。我正在考虑显示一个进度条,显示类似started_automatic_services/automatic_services的内容。还有其他更合适的方法吗?

I have a C# Windows Forms interactive app and a related C# windows service.

On the particular machines where these are deployed, the login and app startup are automatic. The interactive app always starts well before the service. The app has a status indicator to show when it has connected to the service, but these machines are slow and it takes 45-60 seconds for my service to finally get started. During this time, there is nothing happening on the screen.

I should point out that my service starts quickly... it's the dependent (and other) services that are taking some time to start.

I would like to have some sort of indication of the windows startup progress displayed while the application is waiting for the service. I was thinking of showing a progress bar showing something like started_automatic_services/automatic_services. Is there some other more appropriate method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紙鸢 2024-10-30 00:57:36

一种可能是使用 WMI 事件查询< /a> 监视服务启动,这至少可以让您了解进度

Starting services:  
Service 1 started 
Service 2 started etc.

MSDN 示例 订阅和使用管理事件应该足以让您继续下去,因为它具体说明了查询服务以获取状态更改。

One possibility would be to use a WMI event query to monitor the services starting up, which would allow you at least to give an idea of progress

Starting services:  
Service 1 started 
Service 2 started etc.

The MSDN sample Subscribing to and Consuming Management Events should be enough to get you going, as it specifically illustrates querying services for state changes.

り繁华旳梦境 2024-10-30 00:57:36

为什么不使用托盘图标?表示与服务的“断开”或未初始化连接的图像将是最初使用的图像,一旦服务启动,您可以将其更改为“正常”或“一切正常”图标。一些 AV 软件客户端会这样做。

您还可以使用带有覆盖层的相同图标,可能是右下角的小沙漏或类似的东西,然后将其删除。

也许每次用户启动时显示进度条可能会相当干扰和烦人。

Why not use a tray icon? An image that represents a 'broken' or uninitialized connection to your service would be the initial one used, and once the service comes up you can change that to a 'normal' or 'all is well' icon. Some AV software clients do that.

You could also use the same icon with an overlay, maybe a small hourglass on the lower right corner or something like that, and then remove it.

Maybe showing a progress bar every single time the user boots could be rather intrusive and annoying.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文