internal NewForm(NewType type, string info = null) { InitializeComponent(); Options.ApplyTheme(this); _type = type; _name = info; switch (_type) { case NewType.Modify: btnOk.Text = "Save"; if (!string.IsNullOrEmpty(info)) { this.Text = string.Format("Edit account - {0}", info); } else { this.Text = "Add new account..."; } int i = MainForm.Accounts.FindIndex(x => x.Name() == _cryLain.Encrypt(CryLain.ToInsecureString(MainForm.Key), _name)); if (i > -1) { txtName.Text = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Name()); txtMail.Text = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Email()); txtPassword.Text = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Password()); txtNote.Text = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Note()); } break; } }
private void Remove() { var rows = AccountView.SelectedRows; if (rows.Count <= 0) { return; } string name; int i; if (Authorize(LoginType.Remove)) { foreach (DataGridViewRow row in rows) { name = row.Cells[0].Value.ToString(); i = Accounts.FindIndex(x => x.Name() == _cryLain.Encrypt(CryLain.ToInsecureString(Key), name)); if (i > -1) { Accounts.RemoveAt(i); } } LoadAccounts(); } }