Exemplo n.º 1
0
        private void FormSetDB_Load(object sender, EventArgs e)
        {
            if (!isSet)
            {
            #if DEBUG
            #else
                SoftReg sr = new SoftReg();
                string correctNum = sr.GetRNum(sr.GetMNum());
                string regNum = "";
                try
                {
                    regNum = FileConfig.GetConfigValue("Num");
                    regNum = regNum.Replace("-", "");
                }
                catch
                {
                }

                if (!correctNum.Equals(regNum))//注册码错误
                {
                    FormSoftReg fsr = new FormSoftReg();
                    fsr.RegisterEvent += new FormSoftReg.RegisterHandle(fsr_RegisterEvent);
                    fsr.ShowDialog();
                }
                else
                {
                    isRegistered = true;
                }
                if (!isRegistered)//综合判断下来注册码错误
                {
                    this.Close();
                    return;
                }
            #endif
            }
            else
            {
                this.Text = "配置";
                btnLogin.Text = "保  存";
            }

            connString = FileConfig.GetConfigValue("sqlinfoMain");
            string[] connStrs = connString.Split(';');
            tbServer.Text = connStrs[0].Split('=')[1].Trim();
            tbDataBase.Text = connStrs[1].Split('=')[1].Trim();
            tbUser.Text = connStrs[2].Split('=')[1].Trim();
            tbPassWord.Text = connStrs[3].Split('=')[1].Trim();
        }
 private void FormSoftReg_Load(object sender, EventArgs e)
 {
     sr = new SoftReg();
     tbDiskNumber.Text = sr.GetMNum();
 }