static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var needToInit = ConfigurationManager.AppSettings["NeetToInit"].ToString(); if (needToInit == "true") { var settingDlg = new SettingForm("第一次运行,需要先配置一下哦!"); if (settingDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); cfa.AppSettings.Settings["NeetToInit"].Value = "false"; cfa.Save(); Application.Restart(); } } else { var baseUrl = ConfigurationManager.AppSettings["BaseUrl"].ToString(); Service = new Service.Service(baseUrl); LoginForm loginForm = new LoginForm(); if (loginForm.ShowDialog() != DialogResult.OK) { return; } Application.Run(new MainForm()); } }
/// <summary> /// 设置 /// </summary> /// <param name="sender"></param> private void LoginForm_SysBottomClick(object sender) { var settingForm = new SettingForm(); if (settingForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Application.Restart(); } }