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(); }
public AutomationService() { InitializeComponent(); HomeEnvironment.Init(); app = new HomeApplication(); app.Init(); }
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(); }
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(); }
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")); }
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()); }