/// <summary> /// It's an application so let's start it all /// </summary> private static void ApplicationMain() { // Welcome and Start listening _logger = new Logger(MethodBase.GetCurrentMethod().DeclaringType); _logger.AddLog("*** FECS Application Started *** ", LoggerSeverities.Info); /// Determine logging level LoggerSeverities logSeverity = ReadLoggerSeverity(); _logger.AddLog(string.Format("Setting logger severity to {0}: ", logSeverity.ToString()), LoggerSeverities.Info); //OPS.Comm.Messaging.CommMain.Logger.AddLogMessage += new AddLogMessageHandler(Logger_AddLogMessage); //OPS.Comm.Messaging.CommMain.Logger.AddLogException += new AddLogExceptionHandler(Logger_AddLogException); // Start running FecsEngine engine = new FecsEngine(); engine.Start(); // Wait to end _logger.AddLog("*** Press Enter to exit ***", LoggerSeverities.Info); Console.ReadLine(); _logger.AddLog("Quitting...", LoggerSeverities.Info); // Stop running engine.Stop(); // Clean up before we go home //GC.Collect(); GC.WaitForPendingFinalizers(); }
/// <summary> /// Stop this service. /// </summary> protected override void OnStop() { if (_engine != null) { _engine.Stop(); _engine = null; } }
/// <summary> /// Set things in motion so your service can do its work. /// </summary> protected override void OnStart(string[] args) { // The service is starting, so create a new engine and starts it _engine = new FecsEngine(); _engine.Start(); }