Beispiel #1
0
        public static bool AddGroup(Group group)
        {
            _document.Groups.Add(group);

            if (GroupAdded != null)
            {
                GroupAdded.Invoke(group);
            }

            FireDocumentChanged();

            return true;
        }
Beispiel #2
0
        public static bool AddKey(Group group, Key key)
        {
            group.Keys.Add(key);

            if (KeyAdded != null)
            {
                KeyAdded.Invoke(key);
            }

            FireDocumentChanged();

            return true;
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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());
 }
Beispiel #9
0
 void OnGroupSelected(Group g)
 {
     _lvwKeys.Items.Clear();
     foreach (var key in KeyPassMgr.GetKeysForGroup(g))
     {
         UpdateGrid(key);
     }
 }
Beispiel #10
0
        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();
        }
Beispiel #11
0
 public KeyPropertiesForm(Group group, Key key)
     : this()
 {
     _group = group;
     _key = key;
 }
Beispiel #12
0
 public KeyPropertiesForm(Group group)
     : this()
 {
     _group = group;
 }
Beispiel #13
0
        public static bool DeleteGroup(Group group)
        {
            DeleteKeys(group);

            _document.Groups.Remove(group);

            if (GroupDeleted != null)
            {
                GroupDeleted.Invoke(group);
            }

            FireDocumentChanged();

            return true;
        }
Beispiel #14
0
 private void AddGroupNode(Group g)
 {
     var node = _tvwGroups.Nodes.Add(g.GroupName);
     node.Tag = g;
     _tvwGroups.SelectedNode = node;
 }
Beispiel #15
0
        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();
        }
Beispiel #16
0
        public static bool ModifyGroup(Group group)
        {
            if (GroupModified != null)
            {
                GroupModified.Invoke(group);
            }

            FireDocumentChanged();

            return true;
        }
Beispiel #17
0
 public static List<Key> GetKeysForGroup(Group g)
 {
     return g.Keys;
 }
Beispiel #18
0
        public static void DeleteKeys(Group group)
        {
            foreach (Key key in group.Keys)
            {
                if (KeyDeleted != null)
                {
                    KeyDeleted.Invoke(key);
                }
            }

            group.Keys.Clear();

            FireDocumentChanged();
        }
Beispiel #19
0
        public static void DeleteKey(Group g, Key k)
        {
            g.Keys.Remove(k);

            if (KeyDeleted != null)
            {
                KeyDeleted.Invoke(k);
            }

            FireDocumentChanged();
        }