private void btnAdd_Click(object sender, EventArgs e) { string name = null; TextBoxForm form; using (form = new TextBoxForm("Enter password name (e.g: azure.mystorage)")) { if ((form.ShowDialog() != DialogResult.OK) || (form.UserText.Trim().Length == 0)) { return; } name = form.UserText.Trim(); } string password = null; using (form = new TextBoxForm("Enter password", true)) { if (form.ShowDialog() != DialogResult.OK) { return; } password = form.UserText; } PasswordManager.SetPassword(name, password); this.Populate(); }
private void btnChange_Click(object sender, EventArgs e) { if (this.lvPasswords.SelectedItems.Count == 1) { this.lvPasswords.Focus(); string text = this.lvPasswords.SelectedItems[0].Text; string password = null; using (TextBoxForm form = new TextBoxForm("Enter new password", true)) { if ((form.ShowDialog() != DialogResult.OK) || (form.UserText.Length == 0)) { return; } password = form.UserText; } PasswordManager.SetPassword(text, password); this.Populate(); } }
private void Rename(object sender, EventArgs e) { using (TextBoxForm form = new TextBoxForm("Enter custom name for connection:")) { form.UserText = this._node.Repository.DisplayName; if (form.ShowDialog(MainForm.Instance) != DialogResult.OK) { return; } this._node.Repository.DisplayName = form.UserText; } this.SaveAndUpdateNode(); }