static void Main() { var service = new MainService(); service.InizializzaLogging(); if (System.Diagnostics.Debugger.IsAttached || Environment.UserInteractive) { Application.EnableVisualStyles(); Application.Run(new MainForm(service)); } else { ServiceBase.Run(new ServiceBase[] { service }); } }
public MainForm(MainService service) { InitializeComponent(); _service = service; _service.StartServer(this); }