Exemplo n.º 1
0
        /// <summary>
        /// 注册新用户
        /// </summary>
        private void linkLabel_Regist_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FormRegistNewUser form = new FormRegistNewUser();

            if (form.ShowDialog() == DialogResult.OK)
            {
                string userName = form.textBox_UserName.Text;
                string psw      = form.textBox_Psw.Text;

                User newUser = new User(userName, psw);
                UserManager.UserList.Add(newUser);
                UserManager.SaveUserListToFile();

                this.comboBox_UserName.Items.Add(newUser.UserName);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 注册新用户
        /// </summary>
        private void linkLabel_Regist_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FormRegistNewUser form = new FormRegistNewUser();

            //弹出注册对话框,让用户填入信息,判断用户点击结果
            if (form.ShowDialog() == DialogResult.OK)
            {
                string userName = form.textBox_UserName.Text; //抓取用户名
                string psw      = form.textBox_Psw.Text;      //抓取密码

                User newUser = new User(userName, psw);
                UserManager.UserList.Add(newUser);                  //添加新用户名到列表中
                UserManager.SaveUserListToFile();                   //保存文件

                this.comboBox_UserName.Items.Add(newUser.UserName); //将用户名放入windows控件中
            }
        }