Esempio n. 1
0
        static void Main(string[] args)
        {
            NinjectConfiguration.Configure();

            var kernel = NinjectConfiguration.GetInstance().Kernel;

            DbInitializer.Initialize(kernel.Get <IDbContext>()).Wait();

            var inputGpio    = kernel.Get <IGpioInputInterface>();
            var inputManager = kernel.Get <IInputCircuitsManager>();

            inputGpio.CircuitStateChanged = inputManager.HandleCircuitChange;

            LogHelper.LogMessage("Input GPIO: " + baseAddress);

            using (WebApp.Start <WebApiStartup>(url: baseAddress))
            {
                LogHelper.LogMessage("Host started on: " + baseAddress);
#if DEBUG
                while (true)
                {
                    var message = Console.ReadLine();
                    if (!string.IsNullOrEmpty(message))
                    {
                        var arguments = message.Split(':');
                        if (arguments.Count() == 2)
                        {
                            InputPin inputPin;
                            bool     state;

                            var pinParsedSucessfull   = Enum.TryParse(arguments[0], out inputPin);
                            var stateParsedSucessfull = Boolean.TryParse(arguments[1], out state);

                            if (pinParsedSucessfull && stateParsedSucessfull)
                            {
                                inputGpio.CircuitStateChanged(state, inputPin);
                            }
                        }
                    }
                }
#else
                Console.ReadLine();
#endif
            }
        }
Esempio n. 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            NinjectConfiguration.Configure();
            AutoMapperConfiguration.Configure();
            KillSwitch.Instance      = new AppSettingsKillSwitch();
            DataLoadResults.Instance = DataLoadResultImplementation.GetRVCDataLoadResultInstance();
            DBConnectionStatusImplementation.RegisterImplementations();
            AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.UserToken;
            OldContextSynchronizationSwitch.Instance    = new AppSettingsOldContextSynchronization();

            ConfigureViewEngines();
            HttpConfiguration();

            Reporting.Configuration.ConfigureReporting(GlobalConfiguration.Configuration.DependencyResolver);

            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            MvcContext                 = Context;
            Application["context"]     = Context;
            Application["appInstance"] = Context.ApplicationInstance;
        }