コード例 #1
0
ファイル: Program.cs プロジェクト: wadimk/system
        public static void Main(string[] args)
        {
            // init and start
            var config = new HomeConfiguration();
            var app    = new HomeApplication();

            app.StartServices(config);

            // finalize
            void Shutdown()
            {
                System.Console.WriteLine("\nApplication is shutting down...");
                app.StopServices();
                System.Console.WriteLine("Done");
            }

            AssemblyLoadContext.Default.Unloading += context => { Shutdown(); };
            System.Console.CancelKeyPress         += (sender, eventArgs) => { Shutdown(); };

            // wait
            System.Console.WriteLine("Service is available. Press Ctrl+C to exit.");
            var done = new AutoResetEvent(false);

            done.WaitOne();
        }
コード例 #2
0
        private static void TestServer()
        {
            HomeEnvironment.Init();

            var app = new HomeApplication();

            app.Init();
            app.StartServices();

            Console.WriteLine("Service is available. Press ENTER to exit.");
            Console.ReadLine();

            app.StopServices();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: sergshabal/thinking-home
        private static void TestServer()
        {
            var path             = typeof(Program).Assembly.Location;
            var currentDirectory = Path.GetDirectoryName(path);

            Directory.SetCurrentDirectory(currentDirectory);

            var app = new HomeApplication();

            app.Init();
            app.StartServices();

            Console.WriteLine("Service is available. Press ENTER to exit.");
            Console.ReadLine();

            app.StopServices();
        }
コード例 #4
0
 protected override void OnStop()
 {
     app.StopServices();
 }