How to make GUI wait for windows service?

前端 未结 5 1319
轻奢々
轻奢々 2021-01-18 03:35

I wrote a windows service and a gui for it. Of course gui mainly depends on the service. Is there a way for gui to wait for the service? Sometimes I need to reload service c

5条回答
  •  悲&欢浪女
    2021-01-18 03:48

    Use an EventWaitHandle. Your GUI can wait on the WaitHandle and the service will set it which will trigger the GUI to continue on with what it was doing before it started waiting. No polling, no looping, no mess.

    This great article on C# threading is probably a better resource for info on WaitHandles

提交回复
热议问题