public static void Main(string[] args) { var exitEvent = new ManualResetEvent(false); // Set an event handler for ctrl-c Console.CancelKeyPress += (sender, eventArgs) => { eventArgs.Cancel = true; exitEvent.Set(); }; // log some debugging info to console if (args.Contains("--verbose")) { Verbose = true; } // start carbonator in console mode if this flag is specified if (!args.Contains("--console")) { // service mode ServiceBase.Run(new ServiceMode()); } else { // console mode ConsoleMode = true; CarbonatorInstance.StartCollection(); Console.WriteLine("Press ctrl-c to stop . . ."); exitEvent.WaitOne(); CarbonatorInstance.StopCollection(); } }
public static void Main(string[] args) { // log some debugging info to console if (args.Contains("--verbose")) { Verbose = true; } // start carbonator in console mode if this flag is specified if (!args.Contains("--console")) { // service mode ServiceBase.Run(new ServiceMode()); } else { // console mode CarbonatorInstance.StartCollection(); Console.WriteLine("Press any key to stop . . ."); Console.ReadKey(); CarbonatorInstance.StopCollection(); } }
protected override void OnStop() { CarbonatorInstance.StopCollection(); }