public static bool AddGroup(Group group) { _document.Groups.Add(group); if (GroupAdded != null) { GroupAdded.Invoke(group); } FireDocumentChanged(); return true; }
public static bool AddKey(Group group, Key key) { group.Keys.Add(key); if (KeyAdded != null) { KeyAdded.Invoke(key); } FireDocumentChanged(); return true; }
public void OnGroupNew(object sender, EventArgs e) { GroupPropertiesForm f = new GroupPropertiesForm(); using (f) { if (f.ShowDialog(this) == DialogResult.Cancel) return; } Group g = new Group(); g.GroupName = f.GroupName; KeyPassMgr.AddGroup(g); ContextMgr.FireGroupAdded(); }
public static void CloneGroup(Group group) { Group clone = null; using (var ms = new MemoryStream()) { // serialize group object, then rehydrate as new object graph var bf = new BinaryFormatter(); bf.Serialize(ms, group); ms.Position = 0; clone = (Group)bf.Deserialize(ms); } KeyPassMgr.AddGroup(clone); }
private void UpdateGroupCount(Group group) { _groupsLabel.Text = "Groups: "+ KeyPassMgr.GetGroups().Count; }
private void AuditGroupUpdated(Group currentGroup) { Audit("Modify Group: " + currentGroup.ToString()); }
private void AuditGroupDeleted(Group currentGroup) { Audit("Delete Group: " + currentGroup.ToString()); }
private void AuditGroupAdded(Group currentGroup) { Audit("Add Group: " + currentGroup.ToString()); }
void OnGroupSelected(Group g) { _lvwKeys.Items.Clear(); foreach (var key in KeyPassMgr.GetKeysForGroup(g)) { UpdateGrid(key); } }
private void OnOK(object sender, EventArgs e) { if (!ValidateInput()) return; if (_key == null) _key = new Key(); _key.Title = _txtTitle.Text; _key.UserName = _txtUsername.Text; _key.Notes = _txtComment.Text; _key.Password = _txtPassword.Text; _key.Url = _txtURL.Text; _group = (Group)_cbxGroups.SelectedItem; DialogResult = DialogResult.OK; Close(); }
public KeyPropertiesForm(Group group, Key key) : this() { _group = group; _key = key; }
public KeyPropertiesForm(Group group) : this() { _group = group; }
public static bool DeleteGroup(Group group) { DeleteKeys(group); _document.Groups.Remove(group); if (GroupDeleted != null) { GroupDeleted.Invoke(group); } FireDocumentChanged(); return true; }
private void AddGroupNode(Group g) { var node = _tvwGroups.Nodes.Add(g.GroupName); node.Tag = g; _tvwGroups.SelectedNode = node; }
public static void ModifyKey(Group group, Key k) { // find the group associated to the key k Group oldGroup = FindGroupForKey(k); // if the group is different from the group param, then remove from old group and add to new one if (oldGroup != group) { DeleteKey(oldGroup, k); AddKey(group, k); } if (KeyModified != null) { KeyModified.Invoke(k); } FireDocumentChanged(); }
public static bool ModifyGroup(Group group) { if (GroupModified != null) { GroupModified.Invoke(group); } FireDocumentChanged(); return true; }
public static List<Key> GetKeysForGroup(Group g) { return g.Keys; }
public static void DeleteKeys(Group group) { foreach (Key key in group.Keys) { if (KeyDeleted != null) { KeyDeleted.Invoke(key); } } group.Keys.Clear(); FireDocumentChanged(); }
public static void DeleteKey(Group g, Key k) { g.Keys.Remove(k); if (KeyDeleted != null) { KeyDeleted.Invoke(k); } FireDocumentChanged(); }