コード例 #1
0
 /// <summary>
 /// Constructs a new BecsEngine
 /// </summary>
 public BecsEngine()
 {
     if (_mainEngine == null)
     {
         _mainEngine = this;
     }
 }
コード例 #2
0
 /// <summary>
 /// Stop this service.
 /// </summary>
 protected override void OnStop()
 {
     if (_engine != null)
     {
         _engine.Stop();
         _engine = null;
     }
 }
コード例 #3
0
        /// <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("*** BECS Application Started *** ", LoggerSeverities.Info);

            //OPS.Comm.Messaging.CommMain.Logger.AddLogMessage += new AddLogMessageHandler(Logger_AddLogMessage);
            //OPS.Comm.Messaging.CommMain.Logger.AddLogException += new AddLogExceptionHandler(Logger_AddLogException);

            // Start running
            BecsEngine engine = new BecsEngine();

            try
            {
                engine.Start();
            }
            catch (Exception)
            {
                engine = null;
                _logger.AddLog("An error has occurred. Quitting...", LoggerSeverities.Info);
                _logger = null;
                return;
            }

            // 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();
        }
コード例 #4
0
 static BecsEngine()
 {
     _session    = new BecsSession();
     _mainEngine = null;
 }
コード例 #5
0
 /// <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 BecsEngine();
     _engine.Start();
 }