/// <summary> /// 初始化运行环境 /// </summary> public static void InitializeEnvironment() { TypeCache.DoInitialize(); Environment.CurrentDirectory = Application.StartupPath; Thread.CurrentThread.Name = System.Reflection.Assembly.GetEntryAssembly().GetName().Name; log.Info("Has already started."); AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); }