/// <summary> /// Encapsulates the Processes For Adding a Key /// </summary> public void InvokeKeyAdd() { if (ContextMgr.SelectedGroup == null) { MessageBoxHelper.Info(this, "Please Select a Group"); return; } KeyPropertiesForm kpf = new KeyPropertiesForm(); kpf.Text = "Add new Key"; using (kpf) { if (kpf.ShowDialog(this) != DialogResult.OK) { return; } Group g = kpf.SelectedGroup; Key k = kpf.SelectedKey; if (!ContextMgr.AddKeyToGroup(g, k)) { MessageBoxHelper.Error(this, "Key Could not be Added!"); return; } if (g.ToString() == ContextMgr.SelectedGroup.ToString()) { AddListViewItem(k); } } _edited = true; AutoSizeColumns(); }
/// <summary> /// Encapsulates the Processes For Editing a Key /// </summary> public void InvokeKeyEdit() { KeyPropertiesForm kpf = new KeyPropertiesForm(_selectedKey); using (kpf) { if (kpf.ShowDialog(this) != DialogResult.OK) { return; } _selectedKey.Title = kpf.Title; _selectedKey.UserName = kpf.UserName; _selectedKey.PassWord = kpf.PassWord; _selectedKey.Url = kpf.Url; _selectedKey.Notes = kpf.Notes; ModifyListItem(_selectedKey); } _edited = true; AutoSizeColumns(); }