/// <summary> /// If run in a command prompt, it will show the errors, warnings and so on through stdout. /// If run as a Windows service, it will show the errors, warnings and so on in the system event log. /// </summary> /// <param name="args">Not used</param> static void Main(string[] args) { FolderWatchService service = new FolderWatchService(); if (Environment.UserInteractive) { service.OnStart(args); Console.WriteLine("Press any key to stop program"); Console.Read(); service.OnStop(); } else { ServiceBase.Run(service); } }
/// <summary> /// If run in a command prompt, it will show the errors, warnings and so on through stdout. /// If run as a Windows service, it will show the errors, warnings and so on in the system event log. /// </summary> /// <param name="args">Not used</param> static void Main(string[] args) { FolderWatchService service = new FolderWatchService(); if (Environment.UserInteractive) { service.OnStart(args); Console.WriteLine("Press any key to stop program"); Console.Read(); service.OnStop(); } else { ServiceBase.Run(service); } }