C# Windows 窗体 GUI - 监视 Windows 启动
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种可能是使用 WMI 事件查询< /a> 监视服务启动,这至少可以让您了解进度
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
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.
为什么不使用托盘图标?表示与服务的“断开”或未初始化连接的图像将是最初使用的图像,一旦服务启动,您可以将其更改为“正常”或“一切正常”图标。一些 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.