1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Text;
- using System.Windows.Forms;
- namespace MOTINOVA_Motor_Factory_Set
- {
- public partial class Enter : Form
- {
- public Enter()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- public Dictionary<string, string> UserAccount = new Dictionary<string, string>();
- private void Enter_Load(object sender, EventArgs e)
- {
- UserAccount.Clear();
- //读取账户信息
- try
- {
- //加载配置文件
- StreamReader objReader = new StreamReader("UserAccount");
- string sLine = "";
- List<string> userInfo = new List<string>();
- while (sLine != null)
- {
- sLine = objReader.ReadLine();
- userInfo.Add(sLine);
- }
- objReader.Close();
- foreach(string info in userInfo)
- {
- if (info != null)
- {
- UserAccount.Add(info.Split(',')[0].Split('=')[1], info.Split(',')[1].Split('=')[1]);
- }
- }
- }
- catch (System.Exception)
- {
- MessageBox.Show("无账户信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- UserAccount.Add("未知用户", "");
- }
- //账户名下拉列表更新
- comboBox_User.Items.Clear();
- foreach (string key in UserAccount.Keys)
- {
- comboBox_User.Items.Add(key);
- }
- //密码框清空
- textBox_Passwd.Text = "";
- }
- private void button_keyboard_Click(object sender, EventArgs e)
- {
- System.Diagnostics.Process.Start("osk.exe");
- }
- private void textBox_Passwd_KeyUp(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- this.Close();
- }
- }
- }
|