Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public AutomationService()
        {
            InitializeComponent();

            HomeEnvironment.Init();

            app = new HomeApplication();
            app.Init();
        }
Esempio n. 3
0
        protected override void OnStart(string[] args)
        {
            appTask = Task.Run(() => {
                var app = new HomeApplication();
                app.Init();
                app.StartServices();

                return(app);
            });
        }
        public AutomationService()
        {
            InitializeComponent();

            var path             = typeof(Program).Assembly.Location;
            var currentDirectory = Path.GetDirectoryName(path);

            Directory.SetCurrentDirectory(currentDirectory);

            app = new HomeApplication();
            app.Init();
        }
Esempio n. 5
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();
        }
Esempio n. 6
0
        public IActionResult Confirmation()
        {
            var application = new HomeApplication();

            application.FullName   = (string)TempData["FullName"];
            application.Email      = (string)TempData["Email"];
            application.Light      = (string)TempData["Light"];
            application.Brightness = int.Parse((string)TempData["Brightness"]);

            _repository.Insert(application);


            return(View("Confirmation"));
        }
Esempio n. 7
0
        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();
        }
 public int Insert(HomeApplication entity)
 {
     _context.Set <HomeApplication>().Add(entity);
     return(_context.SaveChanges());
 }