private void ActionSimulate(ServicesCollection services) { Console.WriteLine("Simulating service..."); services.Simulate(Task.Factory.StartNew(() => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new StatusDisplay(LocalStatusLogger.GetInstance())); })); }
public ServicesManager(ServicesCollection services) { this.services = services; RegisterAction("install", "Install the service", ActionInstall); RegisterAction("uninstall", "Uninstall the service", ActionUninstall); RegisterAction("reinstall", "Reinstall the service", ActionReinstall); RegisterAction("start", "Start the service", ActionStart); RegisterAction("stop", "Stop the service", ActionStop); RegisterAction("restart", "Restart the service", ActionRestart); RegisterAction("simulate", null, ActionSimulate); }
private void ActionRestart(ServicesCollection services) { Console.WriteLine("Restarting service..."); services.InvokeRestart(); }
private void ActionStop(ServicesCollection services) { Console.WriteLine("Stoping service..."); services.InvokeStop(); }
private void ActionReinstall(ServicesCollection services) { Console.WriteLine("Reinstalling service..."); services.InvokeStop(); services.Reinstall(); }
private void ActionInstall(ServicesCollection services) { Console.WriteLine("Installing service..."); services.Install(); }