private void SavePassword_FormClosing(object sender, FormClosingEventArgs e) { PasswordList pList = new PasswordList(); lblStatus.Text = string.Empty; txtTitle.Text = string.Empty; txtCustom.Text = string.Empty; pList.dgvPasswordList.DataSource = p.GetDataTable(); }
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.S) { PasswordList pList = new PasswordList(); pList.ShowDialog(); } else if (e.Control && e.KeyCode == Keys.C) { if (lstGenerated.SelectedItems.OfType <string>().ToArray().Length > 0) { Clipboard.SetText(string.Join(Environment.NewLine, lstGenerated.SelectedItems.OfType <string>().ToArray())); lblOutput.ForeColor = Color.Green; lblOutput.Text = "Password copied to clipboard"; } else { lblOutput.ForeColor = Color.Red; lblOutput.Text = "You've clicked an empty line!\nPlease generate or select a password"; } } else if (e.Control && e.KeyCode == Keys.P) { string generatedPassword = string.Join(Environment.NewLine, lstGenerated.SelectedItems.OfType <string>().ToArray()); if (generatedPassword != string.Empty) { savePassword.txtPassword.Text = generatedPassword; savePassword.ShowDialog(); } else { savePassword.ShowDialog(); } } else if (e.Control && e.KeyCode == Keys.G) { btnGenerate.PerformClick(); lstGenerated.Focus(); lstGenerated.Select(); } else if (e.KeyCode == Keys.Up) { if (lstGenerated.SelectedIndex > 0) { lstGenerated.SelectedIndex--; } e.Handled = true; } else if (e.KeyCode == Keys.Down) { if (lstGenerated.SelectedIndex < (lstGenerated.Items.Count - 1)) { lstGenerated.SelectedIndex++; } e.Handled = true; } else if (e.Alt && e.KeyCode == Keys.L) { e.SuppressKeyPress = true; if (!chkLower.Checked) { chkLower.Checked = true; } else { chkLower.Checked = false; } } else if (e.Alt && e.KeyCode == Keys.U) { e.SuppressKeyPress = true; if (!chkUpper.Checked) { chkUpper.Checked = true; } else { chkUpper.Checked = false; } } else if (e.Alt && e.KeyCode == Keys.N) { e.SuppressKeyPress = true; if (!chkNumeric.Checked) { chkNumeric.Checked = true; } else { chkNumeric.Checked = false; } } else if (e.Alt && e.KeyCode == Keys.S) { e.SuppressKeyPress = true; if (!chkSpecial.Checked) { chkSpecial.Checked = true; } else { chkSpecial.Checked = false; } } else if (e.Alt) { e.SuppressKeyPress = true; } else if (e.Control && e.KeyCode == Keys.E) { Application.Exit(); } }
private void lnkLblShowPassword_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PasswordList pl = new PasswordList(); pl.ShowDialog(); }