示例#1
0
        static void Main()
        {
            TaskBarAdapter.CheckCreated();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            PrepareAppEnvironment();
            string authEndPoint    = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH);
            string authSmsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTHSMS_END_POINT, Common.INI_FILE_PATH);

            DialogResult dr = DialogResult.OK;

            if (string.IsNullOrEmpty(authEndPoint) || string.IsNullOrEmpty(authSmsEndPoint))
            {
                frmSetting frmS = new frmSetting();
                frmS.SectionSettingsSave += new dSectionSettingsSave((o, ce) =>
                {
                    INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, ce.AuthEndPoint, Common.INI_FILE_PATH);
                    INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTHSMS_END_POINT, ce.AuthSmsEndPoint, Common.INI_FILE_PATH);
                    INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, ce.SmsEndPoint, Common.INI_FILE_PATH);
                    INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_TXT_SMS_SETTING_LAST, ce.TxtSmsSetting, Common.INI_FILE_PATH);
                    INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_ORDER_SMS_SETTING_LAST, ce.OrderSmsSetting, Common.INI_FILE_PATH);
                });
                dr = frmS.ShowDialog();
            }
            if (dr == DialogResult.OK)
            {
                Application.Run(new frmMain());
            }
        }
示例#2
0
        private void tstbn_frmSetting_Click(object sender, EventArgs e)
        {
            frmSetting frm = new frmSetting();

            frm.SectionSettingsSave += new dSectionSettingsSave((o, ce) =>
            {
                INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, ce.AuthEndPoint, Common.INI_FILE_PATH);
                INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTHSMS_END_POINT, ce.AuthSmsEndPoint, Common.INI_FILE_PATH);
                INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, ce.SmsEndPoint, Common.INI_FILE_PATH);
                INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_TXT_SMS_SETTING_LAST, ce.TxtSmsSetting, Common.INI_FILE_PATH);
                INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_ORDER_SMS_SETTING_LAST, ce.OrderSmsSetting, Common.INI_FILE_PATH);
            });
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (MessageBoxAdapter.ShowConfirm("您必须重新启动程序设置才能生效,是否重启程序?", Properties.Settings.Default.MessageBoxTitle) == System.Windows.Forms.DialogResult.OK)
                {
                    Application.Restart();
                }
            }
        }