static void Main() { ////new c1().printName(); ////new c2().printName(); ////new c3().printName(); ////return; try { gc = new GlobalClass(); optFunc = new operateClass(); //LogableClass.ToLog("测试", "看看"); InitSystem(); AllGlobalSetting.wxlog.Log("初始化系统", "各种配置读取完毕并有效初始化!", string.Format(gc.WXLogUrl, gc.WXSVRHost)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //设置应用程序处理异常方式:ThreadException处理 Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); //处理UI线程异常 Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); //处理非UI线程异常 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); wxlog = new WXLogClass("客户端", gc.WXLogNoticeUser, string.Format(gc.WXLogUrl, gc.WXSVRHost)); //指定默认登录用户,为捕捉第一次产生错误用。 if (GlobalClass.TypeDataPoints.First().Value.onlyDebug == 9) //永远不执行,到内部去执行测试界面 { testWindow frm1 = new testWindow(); Application.Run(frm1); } else { frm = new MainForm(); tm_heart = new Timer(); tm_heart.Enabled = true; tm_heart.Interval = 100; tm_heart.Tick += Tm_heart_Tick; Application.Run(frm); } AllGlobalSetting.wxlog.Log("关闭程序", "终止界面", string.Format(gc.WXLogUrl, gc.WXSVRHost)); } catch (Exception ce) { MessageBox.Show(string.Format("{0}:{1}", ce.Message, ce.StackTrace)); } }
public void Init(GlobalClass gc) { if (gc == null) { gc = new GlobalClass(); } this.gc = gc; wxlog = new WXLogClass("服务器管理员", gc.WXLogNoticeUser, string.Format(gc.WXLogUrl, gc.WXSVRHost)); LogableClass.ToLog("初始化服务器设置", "初始化策略列表"); wxlog.Log("初始化服务器设置", "初始化策略列表"); this.AllStrags = InitServerClass.Init_StragList <T>(); LogableClass.ToLog("初始化服务器设置", "初始化运行计划列表"); wxlog.Log("初始化服务器设置", "初始化运行计划列表"); this.AllRunPlannings = InitServerClass.Init_StragPlans <T>(); LogableClass.ToLog("初始化服务器设置", "初始资产单元列表"); wxlog.Log("初始化服务器设置", "初始资产单元列表"); this.AllAssetUnits = InitServerClass.Init_AssetUnits(); this.AllNoClosedChanceList = new Dictionary <string, ChanceClass <T> >(); InitSecurity(); }
static void Main(string[] args) { VerNo = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)); //Xpcom.Initialize("Firefox"); gc = new GlobalClass();//加载根目录config if (!gc.loadSucc) { return; } ////GlobalClass sgc = new GlobalClass(string.Format("config\\",gc.ForWeb)); ////if(sgc.loadSucc)//如果有子目录 ////{ //// gc = sgc; ////} System.Drawing.Image img = null; //string retver = VerPwdClass.getString(img); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args != null && args.Length >= 2) { strName = args[0]; strPassword = args[1]; AutoLogin = true; } Form1 frm = null; wxl = new WXLogClass("客户端", gc.WXLogNoticeUser, string.Format(gc.WXLogUrl, gc.WXSVRHost));//指定默认登录用户,为捕捉第一次产生错误用。 //ContinueRun: try { //var programDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); //Gecko.Xpcom.Initialize(Path.Combine(programDirectory, "xulrunner")); frm = new Form1(strName, strPassword, AutoLogin); string msg = wxl.Log(string.Format("{0}", "客户端启动!")); Application.Run(frm); wxl.Log(string.Format("{0}", "客户端退出!")); } catch (Exception ce) { wxl = new WXLogClass(User, gc.WXLogNoticeUser, gc.WXLogUrl); LogableClass.ToLog("错误", "退出界面:" + ce.Message, ce.StackTrace); wxl.Log("错误退出交易终端,请立即手动启动终端!", string.Format("{0}:退出界面!", Title), string.Format("详细原因[{0}]:{1}", ce.Message, ce.StackTrace)); ////AutoLogin = true; ////if(frm != null) //// GC.SuppressFinalize(frm); ////frm = null; //goto ContinueRun; } finally { GlobalClass.SetConfig(gc.ForWeb); if (frm != null) { GC.SuppressFinalize(frm); } } //Application.Exit(); }
public void setWXLog(WXLogClass mygc) { wxlog = mygc; }
public CalcStragGroupClass(DataTypePoint _dtp) { wxl = new WXLogClass("服务器管理员", GlobalClass.LogUser, string.Format(GlobalClass.LogUrl, GlobalClass.WXLogHost)); dtp = _dtp; }