static void Main(string[] args) { try { if (BindingsCheck.FiftyBindingsWarning()) { return; } System.Threading.Thread.CurrentThread.Name = "Main Thread"; Global.ParseArgs(args); //设置目录 if (!Directory.Exists(Application.StartupPath + "/log")) { Directory.CreateDirectory(Application.StartupPath + "/log"); } Global.CurrentSettingsDirectory = Application.StartupPath + "/log"; if (!File.Exists(Global.CurrentSettingsDirectory + "/WorldWind.xml")) { Global.LoadSettings(); World.LoadSettings(); } else { Global.LoadSettings(Global.CurrentSettingsDirectory); World.LoadSettings(Global.CurrentSettingsDirectory); } Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DevExpress.Skins.SkinManager.EnableFormSkins(); DevExpress.UserSkins.BonusSkins.Register(); MainForm app = new MainForm(); Application.Idle += new EventHandler(app.WorldWindow.OnApplicationIdle); Application.Run(app); World.Settings.Save(); DataProtector dp = new DataProtector(DataProtector.Store.USE_USER_STORE); Global.Settings.ProxyUsername = dp.TransparentEncrypt(Global.Settings.ProxyUsername); Global.Settings.ProxyPassword = dp.TransparentEncrypt(Global.Settings.ProxyPassword); Global.Settings.Save(); } catch (NullReferenceException) { } catch (Exception caught) { Exception e; string errorMessages; try { Log.Write(caught); } catch { } finally { e = caught; errorMessages = "The following error(s) occurred:"; do { errorMessages += "\r\n" + e.Message; e = e.InnerException; }while (e != null); Abort(errorMessages); } } }