public EncyclopediaEntryForm(EncyclopediaEntry entry) { InitializeComponent(); Application.Idle += new EventHandler(Application_Idle); BinarySearchTree <string> bst = new BinarySearchTree <string>(); bst.Add("People"); bst.Add("Places"); bst.Add("Things"); bst.Add("History"); bst.Add("Culture"); bst.Add("Geography"); bst.Add("Organisations"); foreach (EncyclopediaEntry ee in Session.Project.Encyclopedia.Entries) { if ((ee.Category != null) && (ee.Category != "")) { bst.Add(ee.Category); } } CatBox.Items.AddRange(bst.SortedList.ToArray()); fEntry = entry.Copy(); TitleBox.Text = fEntry.Name; CatBox.Text = fEntry.Category; DetailsBox.Text = fEntry.Details; DMBox.Text = fEntry.DMInfo; foreach (EncyclopediaEntry ee in Session.Project.Encyclopedia.Entries) { if (ee.ID == fEntry.ID) { continue; } ListViewItem lvi = EntryList.Items.Add(ee.Name); lvi.Tag = ee; lvi.Checked = (Session.Project.Encyclopedia.FindLink(fEntry.ID, ee.ID) != null); } if (EntryList.Items.Count == 0) { ListViewItem lvi = EntryList.Items.Add("(no entries)"); lvi.ForeColor = SystemColors.GrayText; EntryList.CheckBoxes = false; } update_pictures(); }
public EncyclopediaEntryForm(EncyclopediaEntry entry) { this.InitializeComponent(); Application.Idle += new EventHandler(this.Application_Idle); BinarySearchTree <string> binarySearchTree = new BinarySearchTree <string>(); binarySearchTree.Add("People"); binarySearchTree.Add("Places"); binarySearchTree.Add("Things"); binarySearchTree.Add("History"); binarySearchTree.Add("Culture"); binarySearchTree.Add("Geography"); binarySearchTree.Add("Organisations"); foreach (EncyclopediaEntry encyclopediaEntry in Session.Project.Encyclopedia.Entries) { if (encyclopediaEntry.Category == null || !(encyclopediaEntry.Category != "")) { continue; } binarySearchTree.Add(encyclopediaEntry.Category); } this.CatBox.Items.AddRange(binarySearchTree.SortedList.ToArray()); this.fEntry = entry.Copy(); this.TitleBox.Text = this.fEntry.Name; this.CatBox.Text = this.fEntry.Category; this.DetailsBox.Text = this.fEntry.Details; this.DMBox.Text = this.fEntry.DMInfo; foreach (EncyclopediaEntry encyclopediaEntry1 in Session.Project.Encyclopedia.Entries) { if (encyclopediaEntry1.ID == this.fEntry.ID) { continue; } ListViewItem listViewItem = this.EntryList.Items.Add(encyclopediaEntry1.Name); listViewItem.Tag = encyclopediaEntry1; listViewItem.Checked = Session.Project.Encyclopedia.FindLink(this.fEntry.ID, encyclopediaEntry1.ID) != null; } if (this.EntryList.Items.Count == 0) { ListViewItem grayText = this.EntryList.Items.Add("(no entries)"); grayText.ForeColor = SystemColors.GrayText; this.EntryList.CheckBoxes = false; } this.update_pictures(); }