Why Windows Service support to add controls (components) like a GUI application
As I know, Windows Service is No-GUI application. We will control it using Services tool in Administrator Tools.
However, why I create a Windows Service project (C#) from Visual Studio template. I read code Service1.cs, I see a method InitializeComponent() similar with Windows Form application. When I double click on Service1.cs to open in d开发者_如何学运维esigner mode, I can drag or drop to add or remove controls (components) in this service. I don't know the purpose of this feature.
Please help me when to use this feature. Thanks.
Components are different from controls. They are non-visual objects that allow you to package functionality in a way that can be included in the toolbox and configured in the designer like a control, but work better with services and other non-gui apps.
It is not really a designer, it is merely a visual representation of the components of the service. You cannot design anything, just select the components like the BackgroundWorker, Timer, Service Controller, etc.
It is just a convenient way to manage properties and events of some components.
精彩评论