private void simpleButton1_Click(object sender, EventArgs e) { try { string AdminName = comboBoxEdit1.SelectedItem.ToString(); UserMsg user = null; edit.UserDic.TryGetValue(AdminName, out user); if (textBox1.Text == user.password) { MessageBox.Show($"登录成功,权限为<{user.verify.ToString()}>"); simpleButton4.Visible = true; CurrentUser = user.verify; if (user.verify == Verify.管理员) { simpleButton3.Visible = true; } else { simpleButton3.Visible = false; } } else { MessageBox.Show("密码错误!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { /*textBox1.Text = "";*/ } }
private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e) { UserMsg usermsg = null; UserDic.TryGetValue(comboBoxEdit1.SelectedItem.ToString(), out usermsg); comboBoxEdit2.SelectedItem = usermsg?.verify.ToString(); }