Exemplo n.º 1
0
 public void Run()
 {
     Console.WriteLine($"Starting {Assembly.GetEntryAssembly().FullName} in console, press CTRL+C to exit . . .");
     Console.WriteLine();
     Console.CancelKeyPress += ConsoleOnCancelKeyPress;
     _instance.Start();
     _cancelEvent.Wait();
     Console.WriteLine("CTRL+C pressed, stopping...");
     _instance.Dispose();
 }
Exemplo n.º 2
0
 protected override void OnStart(string[] args)
 {
     try
     {
         _instance.Start();
         base.OnStart(args);
     }
     catch (Exception ex)
     {
         Log.StartupError(ex.ToString());
         TryDispose();
         Environment.Exit(-1);
     }
 }