Exemple #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //检测应用程序是否已经运行
            //如果已经运行,则只允许一个实例
            Process instance = OnlyOneInstance.RunningInstance();
            if (instance != null)
            {
                OnlyOneInstance.HandleRunningInstance(instance);
                return;
            }

            //配置文件不存在或配置已失效,则创建
            if (!GlobalConfigVars.IsWellSetting())
            {
                SettingForm settingForm = new SettingForm();
                // 取消配置,退出应用程序
                if (settingForm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            Application.Run(new MainForm());
        }
Exemple #2
0
 private void btnSetting_Click(object sender, EventArgs e)
 {
     SettingForm settingForm = new SettingForm();
     if (DialogResult.OK == settingForm.ShowDialog())
     {
         ResetDbProvider();
     }
 }