using SSWMS.Common; using SSWMS.Server; using System; using System.ServiceProcess; namespace SSWMS.Service { static class Program { /// /// The main entry point for the application. /// static void Main() { AppSettings.Init(!Environment.UserInteractive); if (Environment.UserInteractive) { Start(); Console.WriteLine("Press Enter to Exit"); Console.ReadLine(); Stop(); } else { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); } } public static int Start() { try { AppSettings.Init(!Environment.UserInteractive); Server.Service.Log += (sFunctionName, sLog) => { MainWindow.log.Error(string.Format("{0} {1}", sFunctionName, sLog)); }; return Server.Service.Start(); } catch { return SystemCode.ConstCode.ServiceStart; } } public static void Stop() { Server.Service.Stop(); } } }