简体   繁体   中英

How Do I Update the Status of Service in the Windows Dialog

How do I update the Status column in the Windows Services Dialog?

  • When the services goes into a (managed) Fault-State...I want to update the dialog

在此处输入图片说明

I hate to answer my own question, but no one has answered this...

Unfortunately, as it turns-out, you cannot directly update the Status field, as it is READ-ONLY. However, you can PAUSE the service, like so:

var serviceController = new ServiceController(ServiceName);
serviceController.Pause();      // Pauses the service
serviceController.Refresh();    // Refreshes the Dialog UI with the new Status

This is unfortunate, as there is no "real" way to show a FAULT-STATE for the service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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