示例#1
0
        /// <summary>
        /// This thread routine performs the task of initializing the ManagementLayer.
        /// </summary>
        /// <param name="stateInfo">Object passed into the method for context info.</param>
        static void ThreadProc(Object stateInfo)
        {
            Log.Info("LiquesceService object starting.");
            LiquesceService me = stateInfo as LiquesceService;

            try
            {
                Log.Info("Running Assembly Information.");

                ManagementLayer.Instance.Start(null);
                Log.Info("Blocking thread ManagementLayer.Instance.Start has exited.");
            }
            catch (Exception ex)
            {
                Log.ErrorException("LiquesceService startup error.", ex);
                if (me != null)
                {
                    me.OnStop();
                    if (RunningAsService)
                    {
                        ((ServiceBase)me) /*.base*/.Stop();
                    }
                }
                throw;
            }
        }
示例#2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            Log.Error("=====================================================================");
            Log.Error("File Re-opened: Ver :" + Assembly.GetExecutingAssembly().GetName().Version.ToString());
            var runner = new LiquesceService();

            if ((args.Length > 0) && ("/debug" == args[0].ToLower()))
            {
                // main service object
                LiquesceService.RunningAsService = false;
                runner.StartService(args);
                Console.WriteLine("Press Q to quit");
                Application.Run();
                runner.StopService();
                // We called the static run, so call the static exit
                Application.Exit();
            }
            else
            {
                LiquesceService.RunningAsService = true;
                ServiceBase.Run(new ServiceBase[] { runner });
            }

            Log.Error("========================Clean=Exit===================================");
        }