public void removeItem(string contName, string itemName) { SingleListNode temp = first.next; if (contName == "") { for (int i = 0; i < numNodes; i++) { if (!temp.isContainer && temp.list.Contains(itemName)) { temp.list.Remove(itemName); } else { temp = temp.next; } } return; } for (int i = 0; i < numNodes; i++) { if (temp.containerName == contName) { temp.list.Remove(itemName); } else { temp = temp.next; } } listChanged(null, EventArgs.Empty); }
private void updateHistoryContainerNames(object sender, EventArgs e) { historyDatesList.Clear(); SingleListNode temp = MultiSDI.Appli.history.getNode(); historyDatesList = MultiSDI.Appli.history.getContainerList(); }
public void removeAll() { first.next = null; numNodes = 0; currentPosition = first; listChanged(null, EventArgs.Empty); }
public SingleLinkedList() { first = new SingleListNode(); first.next = null; currentPosition = first; numNodes = 0; isGettingNodes = false; }
private void buildFavoritesBar() { if (isAddingFav) { isAddingFav = false; return; } SingleListNode tempNode = MultiSDI.Appli.favorites.getNode(); while (tempNode != null) { if (!tempNode.isContainer) { string item = tempNode.list.First(); item = item.Replace("https", ""); item = item.Replace("://", ""); item = item.Replace("www.", ""); ToolStripButton oldButton = favToolStrip.Items[item] as ToolStripButton; ToolStripButton newButton = new ToolStripButton(item, null, null, item); newButton.Click += new EventHandler(favClicked); newButton.AutoSize = false; newButton.Width = 100; newButton.TextAlign = ContentAlignment.MiddleLeft; favToolStrip.Items.Remove(oldButton); favToolStrip.Items.Insert(2, newButton); } else { ToolStripDropDownButton oldButton = favToolStrip.Items[tempNode.containerName] as ToolStripDropDownButton; ToolStripDropDownButton newButton = new ToolStripDropDownButton(tempNode.containerName, null, null, tempNode.containerName); string temp; foreach (string item in tempNode.list) { temp = item; temp = temp.Replace("https", ""); temp = temp.Replace("://", ""); temp = temp.Replace("www.", ""); newButton.DropDownItems.Add(temp, null, favClickedDropDownItem); } favToolStrip.Items.Remove(oldButton); favToolStrip.Items.Insert(2, newButton); if (!favoritesContainers.Contains(tempNode.containerName)) { favoritesContainers.Add(tempNode.containerName); } } tempNode = tempNode.next; } }
public void addToContainer(string item, string containerName) { SingleListNode temp = first.next; while (temp.containerName != containerName) { temp = temp.next; } temp.list.Add(item); listChanged(null, EventArgs.Empty); }
public void add(string item) { SingleListNode newNode = new SingleListNode(); newNode.list.Add(item); newNode.next = null; currentPosition.next = newNode; currentPosition = newNode; numNodes++; listChanged(null, EventArgs.Empty); }
public void createContainer(string name) { SingleListNode newNode = new SingleListNode(); newNode.isContainer = true; newNode.containerName = name; currentPosition.next = newNode; newNode.next = null; currentPosition = currentPosition.next; numNodes++; listChanged(null, EventArgs.Empty); }
//Exports data to be serialized public void GetObjectData(SerializationInfo info, StreamingContext context) { int count = 0; SingleListNode temp = first; while (temp != null) { info.AddValue("ListNode" + count, temp); temp = temp.next; ++count; } Console.WriteLine(count + " items added"); }
private void listItemsInListBox(SingleLinkedList history) { SingleListNode temp = history.getNode(); while (temp != null) { listOfItems.Items.Add(temp.containerName); foreach (string item in temp.list) { listOfItems.Items.Add(item); } temp = temp.next; } }
public List <string> getContainerList() { SingleListNode temp = first.next; List <string> containerNames = new List <string>(); while (temp != null) { if (temp.isContainer) { containerNames.Add(temp.containerName); } temp = temp.next; } return(containerNames); }
//Used for importing data back into class public SingleLinkedList(SerializationInfo info, StreamingContext context) { SingleListNode temp; for (int x = 0; x < info.MemberCount; ++x) { if (x == 0) { first = (SingleListNode)info.GetValue("ListNode" + x, typeof(SingleListNode)); currentPosition = first; } else { temp = (SingleListNode)info.GetValue("ListNode" + x, typeof(SingleListNode)); currentPosition.next = temp; currentPosition = temp; } } }
public void removeContainer(string name) { SingleListNode temp = first.next; SingleListNode beforeTemp = first; for (int i = 0; i < numNodes; i++) { if (temp.containerName == name) { beforeTemp.next = temp.next; } else { beforeTemp = beforeTemp.next; temp = temp.next; } } numNodes--; if (numNodes == 0) { currentPosition = first; } listChanged(null, EventArgs.Empty); }
//*************************// //******HISTORY SECTION******// private void getHistoryContainerNames() { SingleListNode temp = MultiSDI.Appli.history.getNode(); historyDatesList = MultiSDI.Appli.history.getContainerList(); }
private void getFavoritesContainerNames() { SingleListNode temp = MultiSDI.Appli.favorites.getNode(); favoritesContainers = MultiSDI.Appli.favorites.getContainerList(); }