/// <summary> /// works at adding a new entry into the monitee list and storages. /// </summary> public void AddMonitoredItem() { //duplicate should not be added in listview. string[] items = new string[] { FolderSelectorBox.Text, ((DestinationBox.Text != "") ? DestinationBox.Text:_DefaultFolder) }; ListViewItem listItems = new ListViewItem(items[0]); ListViewItem.ListViewSubItem subItem1; listItems.Checked = true; subItem1 = new ListViewItem.ListViewSubItem(listItems, items[1]); //listItems.SubItems.Add(subItem1); xmlData = new XMLData(items[0], items[1], XMLDataList.Type(items[0])); monitee = new FolderMonitor.Monitees.Monitee(items[0], items[1], XMLDataList.Type(items[0])); if (XMLDataList.InsertFile(xmlData) && MoniteeList.InsertMonitee(monitee)) { if (!Monitees.MoniteeList.AddedExtra) { Lists.Items.Add(listItems); Monitees.MoniteeList.AddedExtra = false; } MessageBox.Show("Folder successfully added", "Success"); HasChanged = true; } this.FolderSelectorBox.Text = ""; this.DestinationBox.Text = ""; }
/// <summary> /// imports monitored items and stores them in arraylist /// for program to insert into list view. /// </summary> internal static void ImportItems() { XMLDataListEntry current = head; while (current != null) { Console.WriteLine("exporting"); Monitee monitee = new Monitee(current.Data); MoniteeList.InsertMonitee(monitee); current = current.Next; } }