public void Start() { Console.CancelKeyPress += delegate { UIConsole.Log("Hit Ctrl + C! Closing..."); running = false; }; UIConsole.Log("Headless Main Starting"); FDImageManager.Start(); XXImageManager.Start(); NHImageManager.Start(); SHImageManager.Start(); USImageManager.Start(); FMImageManager.Start(); UNKImageManager.Start(); cn.Start(); httpsv.Start(); running = true; while (running) { Thread.Sleep(10); } UIConsole.Log("Closing program..."); cn.Stop(); httpsv.Stop(); FDImageManager.Stop(); XXImageManager.Stop(); NHImageManager.Stop(); SHImageManager.Stop(); USImageManager.Stop(); FMImageManager.Stop(); UNKImageManager.Stop(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); mtx = new Mutex(); cn = new Connector(); demuxManager = new DemuxManager(); demuxManager.RecordToFile = config.RecordIntermediateFile; cn.StatisticsAvailable += (Statistics_st data) => { mtx.WaitOne(); statistics = data; mtx.ReleaseMutex(); if (data.phaseCorrection != lastPhaseCorrection && lastPhaseCorrection != -1) { //UIConsole.GlobalConsole.Error(String.Format("Costas Loop Desync! Phase correction was {0} and now is {1}.", lastPhaseCorrection, data.phaseCorrection)); //desyncCount++; } frameLockLed.Color = data.frameLock == 1 ? Color.Lime : Color.Red; lastPhaseCorrection = data.phaseCorrection; satelliteBusyLed.Color = data.vcid != 63 && data.frameLock == 1 ? Color.Lime : Color.Red; if (heartBeatLed.Color != Color.Lime) { heartBeatLed.Color = Color.Lime; heartBeatCount = 0; } }; cn.ChannelDataAvailable += (byte[] data) => demuxManager.parseBytes(data); cn.ConstellationDataAvailable += (float[] data) => cons.updateConstellationData(data); statistics = new Statistics_st(); cn.Start(); FDImageManager.Start(); XXImageManager.Start(); NHImageManager.Start(); SHImageManager.Start(); USImageManager.Start(); FMImageManager.Start(); }