示例#1
0
        /// <summary>
        /// “修改密码”窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChangePWDForm_Load(object sender, EventArgs e)
        {
            registry      = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort");       //定义一个注册表
            adminRegistry = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort\admin"); //定义管理员注册表
            userRegistry  = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort\user");  //定义用户注册表

            ras = new RSA();                                                                     //定义一个RAS用于加解密

            userNameTextbox.Text = "欢迎:" + LoginForm.userName;
        }
        /// <summary>
        /// 加载“注册表”的用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteUser_Load(object sender, EventArgs e)
        {
            regedit  = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort\user");
            keyNames = regedit.GetKeyNames();

            foreach (string name in keyNames)
            {
                userComboBox.Items.Add(name);
            }
            if (keyNames.Length > 0)
            {
                userComboBox.Text = userComboBox.Items[0].ToString();
            }
        }
示例#3
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            userCombobox.Items.Add("管理员");
            userCombobox.Items.Add("一般用户");
            userCombobox.Text = userCombobox.Items[0].ToString();
            registry          = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort");       //定义一个注册表
            adminRegistry     = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort\admin"); //定义管理员注册表
            userRegistry      = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort\user");  //定义用户注册表
            ras                   = new RSA();                                                       //定义一个RAS用于加解密
            recaptcha             = reCaptcha();
            recaptchaTextBox.Text = recaptcha;

            access = new Access(accessFileRoad); //数据库加载
        }
示例#4
0
        /// <summary>
        /// 实现“注册表”的注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RegisterForm_Load(object sender, EventArgs e)
        {
            // primaryKey = Registry.CurrentUser;   //注册在当前用户里,如果使用管理员运行该软件才能注册在LocalMachine里。
            //softWare= primaryKey.CreateSubKey(@"SOFTWARE\JUN-SerialPort");

            userCombobox.Items.Add("管理员");
            userCombobox.Items.Add("一般用户");
            userCombobox.Text = userCombobox.Items[0].ToString();

            registry      = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort");       //定义一个注册表
            adminRegistry = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort\admin"); //定义管理员注册表
            userRegistry  = new Regedit(Registry.CurrentUser, @"SOFTWARE\JUN-SerialPort\user");  //定义用户注册表
            ras           = new RSA();                                                           //定义一个RAS对象,用于加密和解密

            access.creatDataDB();                                                                //创建数据库
            access.createUserTable("管理员");                                                       //在数据库创建管理员和一般用户
            access.createUserTable("一般用户");
        }