Exemple #1
0
        private void LaunchConsoleApplication(string[] args)
        {
            try
            {
                HostService hostService = new HostService(_logger, PluginConfigurationSection.Instance);
                hostService.OnStart(args);

                Console.WriteLine("Services running. Press enter to shutdown the services and exit.");
                Console.ReadLine();

                hostService.OnStop();
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception was thrown by the application.");
                Console.WriteLine();
                Console.WriteLine("Exception:");
                Console.WriteLine(e.Message);
                Console.WriteLine();
                Console.WriteLine("Stack trace:");
                Console.WriteLine(e.StackTrace);
                Console.ReadLine();
            }
        }
Exemple #2
0
 protected override void OnStop()
 {
     _hostService.OnStop();
 }