示例#1
0
        // add dependency to IRouteCacheProvider
        public HomeModule(IRouteCacheProvider rc) : base("/")
        {
            routeCache = rc;
            Get("/", p => View["index", GetIndex()], null, "Shows available routes.");


            //Stop Lighthouse
            Get("/stop", args =>
            {
                LighthouseActorService.StopAsync().Wait();
                return("Stopping Lighthouse at " + DateTime.Now);
            }, null, "Stops Lighthouse.");

            //Restart Lighthouse
            Get("/restart", args =>
            {
                LighthouseActorService.StopAsync().Wait();

                LighthouseActorService = new LighthouseService();

                LighthouseActorService.Start();

                return("Restarting Lighthouse at " + DateTime.Now);
            }, null, "Restarts Lighthouse.");
        }
示例#2
0
        public static void Main(string[] args)
        {
            var lighthouseService
                = new LighthouseService();

            lighthouseService.Start();
            Console.WriteLine("Press Control + C to terminate.");
            Console.CancelKeyPress
                += async(sender, eventArgs) =>
                {
                await lighthouseService.StopAsync();
                };
            lighthouseService.TerminationHandle.Wait();
        }