private void StartLoading(Stopwatch timer) { UpdateProgress("Reading Config File"); AlexaComp.ReadConfig(); UpdateProgress("Creating Port Map", 400); AlexaCompSERVER.ForwardPort(); UpdateProgress("Scanning for RGB Devices"); AlexaComp.LightingControlThread.Start(); UpdateProgress("Assigning Sensors"); HardwareController.InitSensors(); UpdateProgress("Getting Installed Programs"); ProgramInventory.ScanDir(); UpdateProgress("Starting Server"); AlexaCompCore.ServerThread.Start(); UpdateProgress("Starting Server Loop"); AlexaCompCore.ServerLoopThread.Start(); UpdateProgress("Starting AlexaComp", 400); CloseSplashScreen(); AlexaComp.AppWindowThread.Start(); timer.Stop(); AlexaCompCore.Clog(String.Format("Application Window started in {0} ms.", timer.ElapsedMilliseconds)); }
/* * Handler for X button click. */ protected override void OnFormClosing(FormClosingEventArgs e = null) { if (e != null) { base.OnFormClosing(e); } AlexaCompCore.Clog("CLOSING PROGRAM"); AlexaCompCore.stopProgramFlag = true; AlexaCompSERVER.StopServer(); AlexaCompSERVER.DelPortMap(); Environment.Exit(1); }
public static void StopApplication() { Clog("CLOSING PROGRAM"); stopProgramFlag = true; try { AlexaCompSERVER.StopServer(); } catch (NullReferenceException) { Clog("NullReferenceException Caught When Stopping Server"); } catch (Exception e) { Clog("Exception Caught When Stopping Server \n" + e); } try { AlexaCompSERVER.DelPortMap(); } catch (NullReferenceException) { Clog("NullReferenceException Caught When Deleting Port Maps"); } catch (Exception e) { Clog("Exception Caught When Deleting Port Maps\n" + e); } Clog("Exiting..."); Environment.Exit(1); }