Files

65 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AGVSystem
{
public partial class logon : Form
{
public logon()
{
InitializeComponent();
Cls.Param.UserName = Cls.FileRW.ReadIniValue("UserName", "Name", Application.StartupPath + @"\info.ini");
Cls.Param.Password = Cls.FileRW.ReadIniValue("PassWord", "PassWord", Application.StartupPath + @"\info.ini");
txtName.Text = Cls.Param.UserName_temp;
txtPW.Text = Cls.Param.Password_temp;
if (txtName.Text != "")
button1.Text = "退出管理员";
}
private void button1_Click(object sender, EventArgs e)
{
if (button1.Text == "退出管理员")
{
Cls.Param.UserName_temp = "";
Cls.Param.Password_temp = "";
mainfrm.toolStripStatusLabel.Text = "当前用户:匿名登录";
this.Close();
}
else
{
if (Cls.Param.UserName == txtName.Text.Trim() && Cls.Param.Password == txtPW.Text.Trim())
{
Cls.Param.UserName_temp = Cls.Param.UserName;
Cls.Param.Password_temp = Cls.Param.Password;
mainfrm.toolStripStatusLabel.Text = "当前用户:管理员";
this.Close();
}
}
}
private void txtPW_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (txtName.Text != "" && txtPW.Text == "")
{
button1_Click(null,null);
}
}
}
private void log_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
}
}
}