public void NewKey() { ContextManager.SingularKey = null; if (ContextManager.SelectedGroup.Name == "") { MessageBox.Show("You must Select a Group!"); } else { KeyAddEditForm x = new KeyAddEditForm(); if (x.ShowDialog() != DialogResult.OK) { return; } KeyChainManager.AddKey(ContextManager.SelectedGroup, x.Key); ListViewItem l = KeyListView.Items.Add(x.Key.Title); l.Font = preffont; l.SubItems.Add(x.Key.Username); l.SubItems.Add(x.Key.Password); l.SubItems.Add(x.Key.URL); l.Tag = x.Key; KeyChainManager.KeyChain.IsModified = true; invokeKeyModified("New", x.Key); ContextManager.invokeKeysCurrentlySelected(); } }
public void EditKey() { if (ContextManager.SingularKey == null) { MessageBox.Show("You must Select a Key!"); } else { KeyAddEditForm x = new KeyAddEditForm(); if (x.ShowDialog() != DialogResult.OK) { return; } else { KeyChainManager.EditKey(x.Group, x.Key); KeyListView.Items.Clear(); foreach (Key k in ContextManager.SelectedGroup.Keys) { ListViewItem l = KeyListView.Items.Add(k.Title); l.Font = preffont; l.SubItems.Add(k.Username); l.SubItems.Add(k.Password); l.SubItems.Add(k.URL); l.Tag = k; } KeyChainManager.KeyChain.IsModified = true; invokeKeyModified("Edit", x.Key); } ContextManager.invokeKeySelected(); } }
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 ToolsOptions_Click(object sender, EventArgs e) { UserPreferencesForm Options = new UserPreferencesForm(); Options.selectedF = FontSelected; Options.selectedS = FontSize; if (ShowInTaskbar == true) { Options.HideinTaskbar = false; } else { Options.HideinTaskbar = true; } if (Options.ShowDialog() == DialogResult.OK) { if (Options.HideinTaskbar == true) { this.ShowInTaskbar = false; } else { this.ShowInTaskbar = true; } FontSelected = Options.selectedF; FontSize = Options.selectedS; KeyChainManager.invokeSelectedFont(Options.selectedF, Options.selectedS); string executable = Assembly.GetExecutingAssembly().Location; string pathname = Path.GetDirectoryName(executable); string FileName = Path.Combine(pathname, "MyUserPreferences.xml"); if (File.Exists(FileName)) { File.Delete(FileName); } XmlTextWriter PrefSave = new XmlTextWriter(FileName, Encoding.UTF8); using (PrefSave) { PrefSave.Formatting = Formatting.Indented; PrefSave.WriteStartElement("Font"); PrefSave.WriteString(Options.selectedF); PrefSave.WriteStartElement("FontSize"); PrefSave.WriteString(Options.selectedS.ToString()); PrefSave.WriteStartElement("HiddeninTaskbar"); PrefSave.WriteString(Options.HideinTaskbar.ToString()); } } }
private void pasteContextMenuItem_Click(object sender, EventArgs e) { IDataObject GrouptoPaste = Clipboard.GetDataObject(); Group g = (Group)GrouptoPaste.GetData("CopiedGroup"); KeyChainManager.AddGroup(g); TreeNode _Node = new TreeNode(); _Node.Text = g.Name; _Node.Tag = g; GroupTreeView.Nodes.Add(_Node); GroupTreeView.SelectedNode = _Node; KeyChainManager.KeyChain.IsModified = true; invokeGroupModified("Pasted", g); }
public void DeleteGroup() { Group delGroup = ContextManager.SelectedGroup; KeyChainManager.DeleteGroup(delGroup); invokeGroupModified("Deleted", ContextManager.SelectedGroup); if (KeyChainManager.KeyChain.Groups.Count == 0) { ContextManager.SelectedGroup.Keys.RemoveRange(0, ContextManager.SelectedGroup.Keys.Count); ContextManager.invokeGroupSelected(); ContextManager.SelectedGroup = null; } TreeNode _Node = GroupTreeView.SelectedNode; GroupTreeView.Nodes.Remove(_Node); KeyChainManager.KeyChain.IsModified = true; }
private void duplicateEntryContextMenuItem_Click(object sender, EventArgs e) { List <Key> listtoCopy = new List <Key>(); foreach (ListViewItem Selected in KeyListView.SelectedItems) { listtoCopy.Add((Key)Selected.Tag); } foreach (Key k in listtoCopy) { KeyChainManager.AddKey(ContextManager.SelectedGroup, k); ListViewItem l = KeyListView.Items.Add(k.Title); l.SubItems.Add(k.Username); l.SubItems.Add(k.Password); l.SubItems.Add(k.URL); l.Tag = k; } KeyChainManager.KeyChain.IsModified = true; invokeKeyModified("Duplicated", ContextManager.SingularKey); }
public void DuplicateKey() { List <Key> listtoCopy = new List <Key>(); foreach (ListViewItem Selected in KeyListView.SelectedItems) { listtoCopy.Add((Key)Selected.Tag); } foreach (Key k in listtoCopy) { KeyChainManager.AddKey(ContextManager.SelectedGroup, k); ListViewItem l = KeyListView.Items.Add(k.Title); l.Font = preffont; l.SubItems.Add(k.Username); l.SubItems.Add(k.Password); l.SubItems.Add(k.URL); l.Tag = k; } KeyChainManager.KeyChain.IsModified = true; invokeKeyModified("Duplicated", ContextManager.SingularKey); }
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(); } } }
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; }
public void NewGroup() { ContextManager.SelectedGroup = null; GroupAddEditForm g = new GroupAddEditForm(ContextManager.SelectedGroup); if (g.ShowDialog() != DialogResult.OK) { return; } bool success = KeyChainManager.AddGroup(g.Group); TreeNode _Node = new TreeNode(); _Node.Text = g.Group.Name; _Node.Tag = g.Group; _Node.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])); GroupTreeView.Nodes.Add(_Node); GroupTreeView.SelectedNode = _Node; KeyChainManager.KeyChain.IsModified = true; invokeGroupModified("Added", g.Group); }
public KeychainData(KeyChainManager keyChainManager) { this.keyChainManager = keyChainManager; }