宜昌华友成品库管理软件
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.

144 lines
5.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Net;
using System.ServiceModel;
using SiaSun.LMS.Interface;
using System.ServiceProcess;
namespace SiaSun.LMS.WCFHost
{
/// <summary>
/// Program
/// </summary>
public static class MainApp
{
//本机地址
public static IPAddress[] _IPAddressList;
//应用程序路径
public static string _APP_PATH;
//服务地址
public static string _BaseUrl;
//语言
public static string _Language;
public static MAIN mainForm = null;
#region ------业务接口定义
public static SiaSun.LMS.Interface.I_BaseService _I_BaseService = new SiaSun.LMS.Implement.S_BaseService();
public static SiaSun.LMS.Interface.I_SystemService _I_SystemService = new SiaSun.LMS.Implement.S_SystemService();
public static SiaSun.LMS.Interface.I_FlowService _I_FlowService = new SiaSun.LMS.Implement.S_FlowService();
public static SiaSun.LMS.Interface.I_PlanService _I_PlanService = new SiaSun.LMS.Implement.S_PlanService();
public static SiaSun.LMS.Interface.I_ManageService _I_ManageService = new SiaSun.LMS.Implement.S_ManageService();
public static SiaSun.LMS.Interface.I_StorageService _I_StorageService = new SiaSun.LMS.Implement.S_StorageService();
public static SiaSun.LMS.Interface.I_CellService _I_CellService = new SiaSun.LMS.Implement.S_CellService();
public static SiaSun.LMS.Interface.I_LEDService _I_LedService = new SiaSun.LMS.Implement.S_LEDService();
/// <summary>
/// 基础服务类
/// </summary>
//public static SiaSun.LMS.Interface.I_BaseService _I_BaseService
//{
// get { return SiaSun.LMS.Common.WCFHelper.Create<I_BaseService>(string.Format(_BaseUrl + "/BaseService")); }
//}
///// <summary>
///// 系统类
///// </summary>
//public static SiaSun.LMS.Interface.I_SystemService _I_SystemService
//{
// get { return SiaSun.LMS.Common.WCFHelper.Create<I_SystemService>(string.Format(_BaseUrl + "/SystemService")); }
//}
///// <summary>
///// 状态流程类
///// </summary>
//public static SiaSun.LMS.Interface.I_FlowService _I_FlowService
//{
// get { return SiaSun.LMS.Common.WCFHelper.Create<I_FlowService>(string.Format(_BaseUrl + "/FlowService")); }
//}
///// <summary>
///// 计划类
///// </summary>
//public static SiaSun.LMS.Interface.I_PlanService _I_PlanService
//{
// get { return SiaSun.LMS.Common.WCFHelper.Create<I_PlanService>(string.Format(_BaseUrl + "/PlanService")); }
//}
///// <summary>
///// 任务类
///// </summary>
//public static SiaSun.LMS.Interface.I_ManageService _I_ManageService
//{
// get { return SiaSun.LMS.Common.WCFHelper.Create<I_ManageService>(string.Format(_BaseUrl + "/ManageService")); }
//}
///// <summary>
///// 库存存储类
///// </summary>
//public static SiaSun.LMS.Interface.I_StorageService _I_StorageService
//{
// get { return SiaSun.LMS.Common.WCFHelper.Create<I_StorageService>(string.Format(_BaseUrl + "/StorageService")); }
//}
///// <summary>
///// 仓储货位类
///// </summary>
//public static SiaSun.LMS.Interface.I_CellService _I_CellService
//{
// get { return SiaSun.LMS.Common.WCFHelper.Create<I_CellService>(string.Format(_BaseUrl + "/CellService")); }
//}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
//获得语言
_Language = SiaSun.LMS.Common.AppSettings.GetValue("Language");
//获得服务地址
_BaseUrl = SiaSun.LMS.Common.StringUtil.GetConfig("SiaSunSrvUrl");
//获得执行程序的路径
_APP_PATH = AppDomain.CurrentDomain.BaseDirectory;
//获得IP地址
_IPAddressList = Dns.GetHostAddresses(Dns.GetHostName());
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//add by yangjian
//ServiceHost clientAccessPolicy = new ServiceHost(typeof(SiaSun.LMS.Implement.S_ClientAccessPolicy));
//clientAccessPolicy.Open();
using (Process p = SiaSun.LMS.Common.SingleInstance.GetRunningInstance())
{
if (p != null) //已经有应用程序副本执行
{
System.Windows.Forms.MessageBox.Show("请检查程序是否已经隐藏在后台运行!", "系统提示");
//SiaSun.LMS.Common.SingleInstance.HandleRunningInstance(p);
p.Dispose();
}
else
{
mainForm = new MAIN();
Application.Run(mainForm);
}
}
}
}
}