/// <summary> /// Encapsulates the Processes For Adding a Key /// </summary> public void InvokeKeyAdd() { if (ContextMgr.SelectedGroup == null) { MessageBoxHelper.Info(this, "Please Select a Group"); return; } KeyPropertiesForm kpf = new KeyPropertiesForm(); kpf.Text = "Add new Key"; using (kpf) { if (kpf.ShowDialog(this) != DialogResult.OK) { return; } Group g = kpf.SelectedGroup; Key k = kpf.SelectedKey; if (!ContextMgr.AddKeyToGroup(g, k)) { MessageBoxHelper.Error(this, "Key Could not be Added!"); return; } if (g.ToString() == ContextMgr.SelectedGroup.ToString()) { AddListViewItem(k); } } _edited = true; AutoSizeColumns(); }
/// <summary> /// Clears the interface and refreshes the Document /// </summary> public void ClearDocument() { foreach (Group g in ContextMgr.Document.Groups) { DeleteTreeNode(g); ContextMgr.FireGroupSelected(); } ContextMgr.Document.Groups.Clear(); }
private void PasteKeys() { IDataObject ido = Clipboard.GetDataObject(); if (ido.GetDataPresent("KeyObject")) { List <Key> newKeys = (List <Key>)ido.GetData("KeyObject"); foreach (Key k in newKeys) { Key newKey = new Key(k.Title, k.UserName, k.PassWord, k.Url, k.Notes); ContextMgr.AddKeyToGroup(ContextMgr.SelectedGroup, newKey); AddListViewItem(newKey); } } }
public void TestSystemInfo() { Boolean retVal = false; String fileDate = DateTime.Now.ToString("yyyyMMdd-HHmmssfff"); String fileName = $@"{Environment.CurrentDirectory}\Logs\TestLog{fileDate}.txt"; if (!Directory.Exists($@"{Environment.CurrentDirectory}\Logs")) { Directory.CreateDirectory($@"{Environment.CurrentDirectory}\Logs"); } Int32 daysToRetainLogs = 14; LOG_TYPE debugLogOptions = LOG_TYPE.Error | LOG_TYPE.Warning | LOG_TYPE.System | LOG_TYPE.Test | LOG_TYPE.ShowModuleClassAndLineNumber | LOG_TYPE.ShowTimeOnly; IContextMgr appContext = new ContextMgr(); appContext.DaysToRetainLogs = daysToRetainLogs; appContext.DebugLogOptions = debugLogOptions; appContext.LogFileName = fileName; appContext.SharedList.Add("CurrentDirectory", Environment.CurrentDirectory); appContext.SharedList.Add("CurrentManagedThreadId", Environment.CurrentManagedThreadId); appContext.SharedList.Add("Is64BitOperatingSystem", Environment.Is64BitOperatingSystem); appContext.SharedList.Add("Is64BitProcess", Environment.Is64BitProcess); appContext.SharedList.Add("MachineName", Environment.MachineName); appContext.SharedList.Add("OSVersion", Environment.OSVersion); appContext.SharedList.Add("ProcessorCount", Environment.ProcessorCount); appContext.SharedList.Add("UserDomainName", Environment.UserDomainName); appContext.SharedList.Add("UserName", Environment.UserName); SystemInfo si = new SystemInfo(appContext); retVal = si.LogTheSystem(); si = null; Assert.IsTrue(retVal, "SystemInfo test failed."); }
/// <summary> /// Process for Deleting a Group /// </summary> public void InvokeGroupDelete() { DialogResult dr = MessageBoxHelper.QuestionYesNo(this, "This permanently deletes a Group\n Are You Sure?"); if (dr == DialogResult.No) { return; } Group deleteGroup = (Group)_groupTreeView.SelectedNode.Tag; if (!ContextMgr.Deletegroup(deleteGroup)) { MessageBoxHelper.Error(this, "Group could not be deleted!"); return; } DeleteTreeNode(deleteGroup); ContextMgr.FireGroupSelected(); MessageBoxHelper.Info(this, "Group Deleted!"); _edited = true; }
/// <summary> /// Process For Adding a Group /// </summary> public void InvokeGroupAdd() { GroupPropertiesForm gpf = new GroupPropertiesForm(); using (gpf) { gpf.Text = "Add New Group"; if (gpf.ShowDialog(this) != DialogResult.OK) { return; } Group newGroup = new Group(gpf.GroupName, 0); if (!ContextMgr.AddNewGroup(newGroup)) { MessageBoxHelper.Error(this, "Group could not be added!"); return; } AddTreeNode(newGroup); } _edited = true; }
private void onPasteGroup(object sender, EventArgs e) { IDataObject ido = Clipboard.GetDataObject(); if (ido.GetDataPresent("GroupObject")) { Group newGroup = (Group)ido.GetData("GroupObject"); Group g = new Group(newGroup.Name, 0); if (!ContextMgr.AddNewGroup(g)) { MessageBoxHelper.Error(this, "Group could not be added!"); return; } if (newGroup.Keys != null) { foreach (Key k in newGroup.Keys) { ContextMgr.AddKeyToGroup(g, k); } } AddTreeNode(newGroup); } }
/// <summary> /// Encapsulates the Processes For Editing a Key /// </summary> public void InvokeKeyDelete() { DialogResult dr = MessageBoxHelper.QuestionYesNo(this, "This Permanently deletes a Key"); if (dr == DialogResult.No) { return; } foreach (ListViewItem lvi in _keylistView.SelectedItems) { Key _key = (Key)lvi.Tag; if (!ContextMgr.DeleteKeyFromGroup(ContextMgr.SelectedGroup, _key)) { MessageBoxHelper.Error(this, "Key Could not be Deleted"); return; } DeleteListItem(_key); } _edited = true; AutoSizeColumns(); MessageBoxHelper.Info(this, "Key Sucessfully Deleted"); }