Ejemplo n.º 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();
     }
 }
Ejemplo n.º 2
0
        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();
                }
            }
        }