static void Main() { var service = new CSVFileWatcherService(); service.Directory = @"D:\CSV\"; service.FilesMask = "*.csv"; if (Environment.UserInteractive) { AllocConsole(); service.Start(); Console.ReadKey(); service.Stop(); } else { ServiceBase.Run(service); } }
static void Main(string[] args) { var service = new CSVFileWatcherService(); service.Directory = @"C:\"; service.FilesMask = "*.csv"; if (Environment.UserInteractive) { AllocConsole(); Console.CancelKeyPress += (x, y) => service.Stop(); service.Start(); Console.ReadKey(); service.Stop(); } else { ServiceBase.Run(service); } }