Exemple #1
0
 public void DeleteKey()
 {
     if (ContextManager.SingularKey == null)
     {
         MessageBox.Show("No Keys Selected");
     }
     else
     {
         foreach (ListViewItem Selected in KeyListView.SelectedItems)
         {
             ContextManager.CurrentKeySelection = ContextManager.CurrentKeySelection + 1;
             Key KeySelect = (Key)KeyListView.SelectedItems[0].Tag;
             Key delKey    = KeyChainManager.FindKey(ContextManager.SelectedGroup, KeySelect);
             KeyChainManager.DeleteKey(KeyChainManager.FindGroup(ContextManager.SelectedGroup), delKey);
             invokeKeyModified("Deleted", KeySelect);
             KeyListView.BeginUpdate();
             ContextManager.SingularKey = null;
             KeyListView.SelectedItems[0].Remove();
             KeyListView.EndUpdate();
         }
         KeyChainManager.KeyChain.IsModified = true;
         ContextManager.invokeKeySelected();
         ContextManager.invokeKeysCurrentlySelected();
     }
 }
        private void OnKeySelected(Key k)
        {
            _KeyDetailRichTextBox.Font = pFont;
            if (KeyCurrentlySelected == true)
            {
                if (ContextManager.SingularKey != null)
                {
                    _KeyDetailRichTextBox.Clear();
                    Key toWrite = KeyChainManager.FindKey
                                      (KeyChainManager.FindGroup(ContextManager.SelectedGroup), ContextManager.SingularKey);
                    string groupName = KeyChainManager.FindGroup(ContextManager.SelectedGroup).Name;

                    String WriteLine = String.Format("Title= {0}", toWrite.Title);
                    _KeyDetailRichTextBox.AppendText(WriteLine);
                    _KeyDetailRichTextBox.AppendText(Environment.NewLine);
                    WriteLine = String.Format("Username= {0}", toWrite.Username);
                    _KeyDetailRichTextBox.AppendText(WriteLine);
                    _KeyDetailRichTextBox.AppendText(Environment.NewLine);
                    WriteLine = String.Format("Password= {0}", toWrite.Password);
                    _KeyDetailRichTextBox.AppendText(WriteLine);
                    _KeyDetailRichTextBox.AppendText(Environment.NewLine);
                    WriteLine = String.Format("Confirm Password= {0}", toWrite.ConfirmPassword);
                    _KeyDetailRichTextBox.AppendText(WriteLine);
                    _KeyDetailRichTextBox.AppendText(Environment.NewLine);
                    WriteLine = String.Format("URL= {0}", toWrite.URL);
                    _KeyDetailRichTextBox.AppendText(WriteLine);
                    _KeyDetailRichTextBox.AppendText(Environment.NewLine);
                    _KeyDetailRichTextBox.AppendText("Notes:");
                    _KeyDetailRichTextBox.AppendText(Environment.NewLine);
                    _KeyDetailRichTextBox.AppendText("___________________________________");
                    _KeyDetailRichTextBox.AppendText(Environment.NewLine);
                    _KeyDetailRichTextBox.AppendText(toWrite.Note);
                }
                else
                {
                    _KeyDetailRichTextBox.Clear();
                }
            }
        }
Exemple #3
0
        public void EditGroup()
        {
            GroupAddEditForm g = new GroupAddEditForm(ContextManager.SelectedGroup);

            ContextManager.SelectedGroup = (KeyChainManager.FindGroup((Group)GroupTreeView.SelectedNode.Tag));
            if (g.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            ContextManager.SelectedGroup = KeyChainManager.EditGroup(ContextManager.SelectedGroup, g.Group);
            ContextManager.SelectedGroup = KeyChainManager.FindGroup(ContextManager.SelectedGroup);
            TreeNode _Node = new TreeNode();

            _Node.Text      = ContextManager.SelectedGroup.Name;
            _Node.Tag       = ContextManager.SelectedGroup;
            _Node.ForeColor = (Color.FromArgb(ContextManager.SelectedGroup.TextColor[0], ContextManager.SelectedGroup.TextColor[1], ContextManager.SelectedGroup.TextColor[2]));
            GroupTreeView.SelectedNode.Text      = ContextManager.SelectedGroup.Name;
            GroupTreeView.SelectedNode.ForeColor = (Color.FromArgb(g.Group.TextColor[0], g.Group.TextColor[1], g.Group.TextColor[2]));
            //take the next 1 line out if professor says to tonight
            GroupTreeView.ForeColor = (Color.FromArgb(g.Group.TextColor[0], g.Group.TextColor[1], g.Group.TextColor[2]));
            invokeGroupModified("Edited", g.Group);
            KeyChainManager.KeyChain.IsModified = true;
        }