魔兽登陆系统

Posted aaaaliling

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了魔兽登陆系统相关的知识,希望对你有一定的参考价值。

public  class LoginInfo
    {
      /// <summary>
      /// 用户信息类
      /// </summary>
        private string email;

        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        private int id;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        private string password;

        public string Password
        {
            get { return password; }
            set { password = value; }
        }
    }

 

技术分享图片

 1  /// <summary>
 2         /// 用户信息验证及登陆功能实现
 3         /// </summary>
 4         /// <param name="sender"></param>
 5         /// <param name="e"></param>
 6         private void btnLogin_Click(object sender, EventArgs e)
 7         {
 8             
 9             if (txtEmail.Text.Trim() == "" || txtPwd.Text.Trim() == "")
10             {
11                 MessageBox.Show("用户名和密码不允许为空!");
12 
13 
14             }
15             else
16             {
17                 string username = txtEmail.Text;
18                 string pwd = txtPwd.Text;
19                 bool isOk = false;
20                 foreach (LoginInfo item in array)
21                 {
22                     if (item != null)
23                     {
24                         if (item.Email == username && item.Password == pwd)
25                         {
26                             isOk = true;
27                             FrmMain frm = new FrmMain();
28 
29                             frm.lblNames.Text = "欢迎," + item.Name;
30                             frm.Show();
31                             break;
32 
33                         }
34                     }
35                 }
36                 if (isOk == false)
37                 {
38                     txtPwd.Text = "";
39                     txtEmail.Focus();
40                 }
41             }
42             
43         }
44        
45         private void label2_Click(object sender, EventArgs e)
46         {
47             //创建注册窗体对象
48             FrmRegist frm = new FrmRegist();
49             frm.fl = this;
50             frm.Show();
51             this.Hide();//登陆隐藏窗体
52         }
53 
54         private void pictureBox2_Click(object sender, EventArgs e)
55         {
56             this.Close();
57         }
58         public LoginInfo[] array;//存储登录用户信息的对象数组
59         private void FrmLogin_Load(object sender, EventArgs e)
60         {
61             //初始用户信息
62             array = new LoginInfo[10];
63 
64             
65         }

技术分享图片

 1  /// <summary>
 2       /// 登陆窗体对象
 3       /// </summary>
 4       /// <param name="sender"></param>
 5       /// <param name="e"></param>
 6         private void btnMian_Click(object sender, EventArgs e)
 7         {
 8             LoginInfo info = new LoginInfo();
 9             info.Name = txtName.Text;
10             info.Id = Convert.ToInt32(txtMa.Text);
11             info.Email = txtEmail.Text;
12             info.Email = txtEmails.Text;
13             info.Password = txtPwd.Text;
14             info.Password = txtPwds.Text;
15             if (this.txtName.Text.Trim()=="")
16             {
17                 MessageBox.Show("信息不能为空!");
18                 this.txtName.Focus();
19 
20             }
21             else if (this.txtMa.Text.Trim() == "")
22             {
23                 MessageBox.Show("信息不能为空!");
24                 this.txtMa.Focus();
25 
26             }
27             else if (this.txtEmail.Text.Trim() == "")
28             {
29                 MessageBox.Show("信息不能为空!");
30                 this.txtEmail.Focus();
31 
32             }
33             else if (this.txtEmails.Text.Trim() == "")
34             {
35                 MessageBox.Show("信息不能为空!");
36                 this.txtEmails.Focus();
37 
38             }
39             else if (this.txtPwd.Text.Trim() == "")
40             {
41                 MessageBox.Show("信息不能为空!");
42                 this.txtPwd.Focus();
43 
44             }
45             else if (this.txtPwds.Text.Trim() == "")
46             {
47                 MessageBox.Show("信息不能为空!");
48                 this.txtPwd.Focus();
49 
50             }
51             else
52             {   
53                 MessageBox.Show("注册成功!");
54                 for (int i = 0; i < fl.array.Length; i++)
55                 {
56                     if(fl.array[i]==null)
57                     {
58                         fl.array[i] = info;
59                         break;
60                     }
61                 }
62 
63                 fl.Visible = true;
64                 this.Close();
65             }
66            
67 
68         }

技术分享图片

以上是关于魔兽登陆系统的主要内容,如果未能解决你的问题,请参考以下文章

魔兽登陆界面制作

魔兽世界自从删了interface文件夹后,所有的大号所在区都是登陆读蓝条后直接与服务器连接中断

怎么玩魔兽私服

关于多账户登陆的问题

第一章魔兽窗口

第一章魔兽窗口