Logon to Warcraft, logon to Warcraft
Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Linq;
Using System. Text;
Using System. Threading. Tasks;
Using System. Windows. Forms;
Namespace MyWarcraft
{
Public partial class FrmLogin: Form
{
Public FrmLogin ()
{
InitializeComponent ();
}
Public LoginInfo [] array; // used to store login user information
Private void FrmLogin_Load (object sender, EventArgs e)
{
// Initial three user information
Array = new LoginInfo [10];
LoginInfo info1 = new LoginInfo ();
Info1.Name = "Sun Lili ";
Info1.Id = "120185198005088521 ";
Info1.Email = "lili@sohu.com ";
Info1.Password = "lili1980 ";
Array [0] = info1;
LoginInfo info2 = new LoginInfo ();
Info2.Name = "fan Jingjing ";
Info2.Id = "110186198111088725 ";
Info2.Email = "jingjing@sina.com ";
Info2.Password = "jingjing ";
Array [1] = info2;
LoginInfo info3 = new LoginInfo ();
Info3.Name = "Chen xiaokun ";
Info3.Id = "110125197905123571 ";
Info3.Email = "xiaokun@sohu.com ";
Info3.Password = "chenkun ";
Array [2] = info3;
LblValidation. Visible = false; // hide the verification prompt information at the initial stage.
}
Private void btnLogin_Click (object sender, EventArgs e)
{
If (txtEmail. Text. Trim () = "" | txtPwd. Text. Trim () = "")
{
MessageBox. Show ("the user name or password cannot be blank! "," Prompt ");
}
Else
{
String userName = txtEmail. Text;
String pwd = txtPwd. Text;
Bool isOK = false;
Foreach (LoginInfo item in array)
{
If (item! = Null)
{
If (item. Email = userName & item. Password = pwd)
{
LblValidation. Visible = false;
IsOK = true;
FrmMain fm = new FrmMain ();
Fm. lblName. Text = "Welcome," + item. Name; // pass the information to the Home Page
Fm. Show ();
Break;
}
}
}
If (isOK = false)
{
LblValidation. Visible = true;
TxtPwd. Text = "";
TxtPwd. Focus ();
}
}
}
Private void llbRegist_LinkClicked (object sender, LinkLabelLinkClickedEventArgs e)
{
FrmRegist fr = new FrmRegist ();
Fr. fl = this;
Fr. Show ();
This. Hide (); // Hide the logon form
}
Private void picClose_Click (object sender, EventArgs e)
{
Application. Exit ();
}
Private void picturebox#click (object sender, EventArgs e)
{
}
}
}
Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Linq;
Using System. Text;
Using System. Threading. Tasks;
Using System. Windows. Forms;
Namespace MyWarcraft
{
Public partial class FrmRegist: Form
{
Public FrmRegist ()
{
InitializeComponent ();
LblEqualEmail. Visible = false;
LblEqualPwd. Visible = false;
LblInfo. Visible = false;
}
Public FrmLogin fl; // logon form object
Private void btnRegist_Click (object sender, EventArgs e)
{
LblInfo. Visible = false;
If (txtName. text. trim () = "" | txtId. text. trim () = "" | txtEmail. text. trim () = "" | txtReEmail. text. trim () = "" | txtPwd. text. trim () = "" | txtRePwd. text. trim () = "")
{
LblInfo. Visible = true;
Return;
}
Bool isOK = true;
LoginInfo info = new LoginInfo ();
Info. Name = txtName. Text;
Info. Id = txtId. Text;
If (txtEmail. Text = txtReEmail. Text)
{
Info. Email = txtEmail. Text;
LblEqualEmail. Visible = false;
}
Else
{
IsOK = false;
LblEqualEmail. Visible = true;
}
If (txtPwd. Text = txtRePwd. Text)
{
Info. Password = txtPwd. Text;
LblEqualPwd. Visible = false;
}
Else
{
IsOK = false;
LblEqualPwd. Visible = true;
}
If (isOK)
{
MessageBox. Show ("congratulations, verification passed! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Information );
// Locate the idle position in the array and pass the registered object
For (int I = 0; I <fl. array. Length; I ++)
{
If (fl. array [I] = null)
{
Fl. array [I] = info;
Break;
}
}
Fl. Visible = true;
This. Close ();
}
}
Private void btnCancel_Click (object sender, EventArgs e)
{
This. Close ();
}
Private void panel2_Paint (object sender, PaintEventArgs e)
{
}
Private void panelappspaint (object sender, PaintEventArgs e)
{
}
}
}
Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Linq;
Using System. Text;
Using System. Threading. Tasks;
Using System. Windows. Forms;
Namespace MyWarcraft
{
Public partial class FrmMain: Form
{
Public FrmMain ()
{
InitializeComponent ();
}
Private void FrmMain_Load (object sender, EventArgs e)
{
}
Private void picClose_Click (object sender, EventArgs e)
{
This. Close ();
}
}
}