Пример #1
0
 private void AddAppointForm_Load(object sender, EventArgs e)
 {
     typeComboBox.SelectedText  = "生产车辆";
     typeComboBox.SelectedIndex = 0;
     managerTextBox.Text        = MainForm.username;
     myMainUI = new InitMainUI(endLoad);
 }
Пример #2
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            myMainUI = new InitMainUI(endLoad);

            //  读取配置文件寻找记住的用户名和密码
            FileStream fs = new FileStream("D:\\data.bin", FileMode.OpenOrCreate);

            if (fs.Length > 0)
            {
                BinaryFormatter           bf    = new BinaryFormatter();
                Dictionary <string, User> users = bf.Deserialize(fs) as Dictionary <string, User>;
                usersAll = users;
                foreach (User user in users.Values)
                {
                    this.usernameComboBox.Items.Add(user.Username);
                }

                //  用户名默认选中第一个
                if (this.usernameComboBox.Items.Count > 0)
                {
                    this.usernameComboBox.SelectedIndex = this.usernameComboBox.Items.Count - 1;
                }

                for (int i = 0; i < users.Count; i++)
                {
                    if (this.usernameComboBox.Text != "")
                    {
                        if (users.ContainsKey(this.usernameComboBox.Text))
                        {
                            this.passwordTextBox.Text     = users[this.usernameComboBox.Text].Password;
                            this.passwordcheckBox.Checked = true;
                        }
                    }
                }
            }
            fs.Close();

            if (this.passwordTextBox.Text.Length > 0)
            {
                if (!isQiehuan)
                {
                    login();
                }
            }
        }