private void refresh() { CheckPro check = new CheckPro(); List <CheckPro.passStruct> list = check.readPassFill(); dataGridView1.DataSource = list; }
private void button1_Click(object sender, EventArgs e) { CheckPro checkPro = new CheckPro(); if (checkPro.checkKeyFile()) { if (checkPro.checkKeyValue(textBox1.Text)) { Main main = new Main(); main.Show(); CheckPro.KEY = textBox1.Text; this.Hide(); } else { MessageBox.Show("密钥错误"); } } else { checkPro.createKey(textBox1.Text); this.Hide(); //先隐藏主窗体 login login = new login(); //重新实例化此窗体 login.ShowDialog(); //已模式窗体的方法重新打开 this.Close(); //原窗体关闭 } }
private void Main_Load(object sender, EventArgs e) { CheckPro check = new CheckPro(); List <CheckPro.passStruct> list = check.readPassFill(); dataGridView1.DataSource = list; }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("请输入密钥", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } FileStream fs = new FileStream("./key", FileMode.Truncate, FileAccess.ReadWrite); fs.Close(); CheckPro cp = new CheckPro(); cp.createKey(textBox1.Text); this.Close(); }
private void login_Load(object sender, EventArgs e) { CheckPro checkPro = new CheckPro(); if (checkPro.checkKeyFile() == false) { label1.Font = new Font(label1.Font.Name, 10); label1.Location = new Point(2, 35); Label lab = new Label(); lab.Location = new Point(50, 5); lab.Size = new Size(300, 20); lab.Text = "首次使用请牢记您设置的密钥"; this.Controls.Add(lab); this.label1.Text = "请输入您的密钥"; } }
private void button1_Click(object sender, EventArgs e) { CheckPro passClass = new CheckPro(); CheckPro.passStruct pass = new CheckPro.passStruct(); pass.no = textBox1.Text; pass.passType = textBox2.Text; pass.passUserName = textBox3.Text; pass.passPassword = textBox4.Text; passClass.updatePassFill(this.ps, pass); Main form = (Main)this.Owner; CheckPro check = new CheckPro(); List <CheckPro.passStruct> list = check.readPassFill(); form.dataGridView1.DataSource = list; //form.Show(); this.Close(); }
private void 除密码ToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { string no = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); CheckPro checkPro = new CheckPro(); CheckPro.passStruct ps = new CheckPro.passStruct(); ps.no = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); ps.passType = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); ps.passUserName = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); ps.passPassword = dataGridView1.SelectedRows[0].Cells[3].Value.ToString(); checkPro.deletePass(ps); this.refresh(); } else { MessageBox.Show("请选中需要修改的行!"); } }