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

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

            FireDocumentChanged();

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

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

            FireDocumentChanged();

            return true;
        }
Example #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();
        }
Example #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);
        }
Example #5
0
 private void UpdateGroupCount(Group group)
 {
     _groupsLabel.Text = "Groups: "+ KeyPassMgr.GetGroups().Count;
 }
Example #6
0
 private void AuditGroupUpdated(Group currentGroup)
 {
     Audit("Modify Group: " + currentGroup.ToString());
 }
Example #7
0
 private void AuditGroupDeleted(Group currentGroup)
 {
     Audit("Delete Group: " + currentGroup.ToString());
 }
Example #8
0
 private void AuditGroupAdded(Group currentGroup)
 {
     Audit("Add Group: " + currentGroup.ToString());
 }
Example #9
0
 void OnGroupSelected(Group g)
 {
     _lvwKeys.Items.Clear();
     foreach (var key in KeyPassMgr.GetKeysForGroup(g))
     {
         UpdateGrid(key);
     }
 }
Example #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();
        }
Example #11
0
 public KeyPropertiesForm(Group group, Key key)
     : this()
 {
     _group = group;
     _key = key;
 }
Example #12
0
 public KeyPropertiesForm(Group group)
     : this()
 {
     _group = group;
 }
Example #13
0
        public static bool DeleteGroup(Group group)
        {
            DeleteKeys(group);

            _document.Groups.Remove(group);

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

            FireDocumentChanged();

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

            FireDocumentChanged();

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

            group.Keys.Clear();

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

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

            FireDocumentChanged();
        }