private void btnStart_Click(object sender, EventArgs e) { timermsg.Start(); MiddlewareLogHelper.hostwcfMsg = new MiddlewareMsgHandler(AddMsg); MiddlewareLogHelper.StartWriteFileLog();//开放中间件日志 int res = TimeCDKEY.InitRegedit(out expireDate, out identify); if (res == 0) { MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Green, "软件已注册,到期时间【" + expireDate + "】"); StartAllHost(); } else if (res == 1) { MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "软件尚未注册,请注册软件"); } else if (res == 2) { MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "注册机器与本机不一致,请联系管理员"); } else if (res == 3) { MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "软件试用已到期"); } else { MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "软件运行出错,请重新启动"); } }
static void Main() { try { MiddlewareLogHelper.hostwcfMsg = new MiddlewareMsgHandler(ShowMsg); MiddlewareLogHelper.StartWriteFileLog();//开放中间件日志 WcfGlobal.MainRoute(); } catch (Exception e) { Console.WriteLine(e.Message); } while (true) { System.Threading.Thread.Sleep(30 * 1000); } }
static void btnStart() { string identify; string expireDate; MiddlewareLogHelper.hostwcfMsg = new MiddlewareMsgHandler(ShowMsg); MiddlewareLogHelper.StartWriteFileLog();//开放中间件日志 int res = TimeCDKEY.InitRegedit(out expireDate, out identify); if (res == 0) { MiddlewareLogHelper.WriterLog("软件已注册,到期时间【" + expireDate + "】"); //WcfGlobal.Identify = identify; //EFWCoreLib.WcfFrame.ServerManage.ClientManage.clientinfoList = new ClientInfoListHandler(BindGridClient); //EFWCoreLib.WcfFrame.ServerManage.RouterManage.hostwcfRouter = new HostWCFRouterListHandler(BindGridRouter); WcfGlobal.MainBase(identify); RunState = HostState.Opened; } else if (res == 1) { MiddlewareLogHelper.WriterLog("软件尚未注册,请注册软件"); } else if (res == 2) { MiddlewareLogHelper.WriterLog("注册机器与本机不一致,请联系管理员"); } else if (res == 3) { MiddlewareLogHelper.WriterLog("软件试用已到期"); } else { MiddlewareLogHelper.WriterLog("软件运行出错,请重新启动"); } }