private static void WaitForInput(string[] args, string url) { Console.WriteLine("Running on {0}", url); Console.WriteLine("Is running on Mono {0}", MonoCheck.IsRunningOnMono()); Console.WriteLine("Press any key to exit"); // Under mono if you deamonize a process a Console.ReadLine will cause an EOF // so we need to block another way if (args.Any(s => s.Equals("-d", StringComparison.CurrentCultureIgnoreCase))) { Thread.Sleep(Timeout.Infinite); } else { Console.ReadKey(); } }
//public static Lazy<IDataHandler> DataHandler = new Lazy<IDataHandler>(() => new DataHandlerServiceObject()); protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { container.Register <IDataHandler>(Bootstrapper.DataHandler.Value); if (MonoCheck.IsRunningOnMono()) { // If this is not executed on RaspberryPI this will throw exception container.Register <IRaspberry>(new Raspberry()); } else { container.Register <IRaspberry>(new DummyRaspberry()); } // This doesn't work for some reason (would need RouteTables.Routes.MapHubs or something...) //GlobalHost.DependencyResolver = new TinyIoCDependencyResolver(container); // This neither //GlobalHost.DependencyResolver.Register(typeof(IDataHandler),() => dh); base.ApplicationStartup(container, pipelines); }