You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
using SSWMS.Common;
|
|
using SSWMS.Server;
|
|
using System;
|
|
using System.ServiceProcess;
|
|
|
|
namespace SSWMS.Service
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
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();
|
|
}
|
|
}
|
|
}
|