private void buttonSetup_Click(object sender, EventArgs e) { FormSetup setup = new FormSetup(); setup.ShowDialog(); }
static void Main() { // 设置应用程序处理异常方式:ThreadException处理 Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); //处理UI线程异常 Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); //处理非UI线程异常 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GlobleVariable.RunLog = new StringBuilder(); int runTime = 0; var firstRunBool = int.TryParse(ConfigurationManager.AppSettings["runTime"].ToString(), out runTime); GlobleVariable.InfoLogger = log4net.LogManager.GetLogger("loginfo"); GlobleVariable.ErrorLogger = log4net.LogManager.GetLogger("logerror"); log4net.Config.XmlConfigurator.Configure(); int BackupTime = 0; if (int.TryParse(ConfigurationManager.AppSettings["BackupTime"].ToString(), out BackupTime)) { GlobleVariable.BackupTime = BackupTime; } else { GlobleVariable.BackupTime = 1; } GlobleVariable.DatabaseAddress = ConfigurationManager.AppSettings["DatabaseAddress"]; if (string.IsNullOrEmpty(GlobleVariable.DatabaseAddress)) { GlobleVariable.DatabaseAddress = "127.0.0.1"; } if (ConfigurationManager.AppSettings["RunTime"] == null || ConfigurationManager.AppSettings["RunTime"] == "0") { var setup = new FormSetup(); setup.ShowDialog(); } else { GlobleVariable.DatabaseAddress = ConfigurationManager.AppSettings["DatabaseAddress"].ToString(); GlobleVariable.DatabaseName = AESHelper.AESDecrypt(ConfigurationManager.AppSettings["DatabaseName"].ToString(), "adsfadsfadfadsfasasdfads"); GlobleVariable.DatabaseUser = AESHelper.AESDecrypt(ConfigurationManager.AppSettings["DatabaseUser"], "adsfadsfadfadsfasasdfads"); GlobleVariable.DatabasePassword = AESHelper.AESDecrypt(ConfigurationManager.AppSettings["DatabasePassword"], "adsfadsfadfadsfasasdfads"); int outLocalKeepDay = -1; if (int.TryParse(ConfigurationManager.AppSettings["LocalKeepDay"], out outLocalKeepDay)) { GlobleVariable.LocalKeeyDay = outLocalKeepDay; } else { GlobleVariable.LocalKeeyDay = -1; } FluentScheduler.JobManager.Initialize(new BackupJobFactory()); } //DateTime lasttime = DateTime.Now; //DateTime.TryParse(ConfigurationManager.AppSettings["LastBackupTime"].ToString(), out lasttime); //GlobleVariable.LastBackupTime = lasttime; GlobleVariable.StartTime = DateTime.Now; GlobleVariable.FangyouClient = ConfigurationManager.AppSettings["FangyouClient"]; GlobleVariable.FangyouVer = ConfigurationManager.AppSettings["FangyouVer"]; Application.Run(new FormMain()); }