/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { if (args.Length == 1 && args[0] == "cmd") { UI2ServiceWrapper wrapper = new UI2ServiceWrapper(); wrapper.Start(); printInstructions(wrapper); string line; while ((line = Console.ReadLine()) != "exit") { Console.WriteLine(line); printInstructions(wrapper); } wrapper.Stop(); } else { Console.WriteLine("Start this program with the argument \"cmd\" to use command-line mode."); ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new UI2Service() }; ServiceBase.Run(ServicesToRun); } }
protected override void OnStart(string[] args) { wrapper = new UI2ServiceWrapper(); wrapper.Start(); }