private void buttonChangeMap_Click(object sender, EventArgs e) { MapComboBoxItem item = (MapComboBoxItem) comboBoxMap.Items[comboBoxMap.SelectedIndex]; if (item != null) { FableMod.TNG.Section section = item.myMap.TNG.get_Sections("NULL"); if (section == null) { section = new Section("NULL"); item.myMap.TNG.AddSection(section); } buttonChangeMap.Enabled = false; buttonChangeMap.Update(); foreach (FableMod.TNG.Thing thing in mySelectedThings) { thing.Detach(); section.AddThing(thing); } buttonChangeMap.Enabled = true; } }
public SectionComboBoxItem(FableMod.TNG.Section section) { mySection = section; }
private void UpdateComboBoxes(FableMod.TNG.Thing[] things) { comboBoxSection.Items.Clear(); if (things == null) { comboBoxMap.Enabled = false; comboBoxSection.Enabled = false; buttonChangeMap.Enabled = false; buttonChangeSection.Enabled = false; } else { comboBoxMap.Enabled = true; comboBoxSection.Enabled = true; buttonChangeMap.Enabled = myMaps.Count > 1; buttonChangeSection.Enabled = true; FableMod.TNG.TNGFile tngFile = null; FableMod.TNG.TNGFile tng = things[0].Section.TNGFile; for (int i = 1; i < things.Length; ++i) { if (tng != things[i].Section.TNGFile) { tng = null; } } comboBoxMap.SelectedIndex = -1; for (int i = 0; i < comboBoxMap.Items.Count; ++i) { MapComboBoxItem item = (MapComboBoxItem)comboBoxMap.Items[i]; if (item.myMap.TNG == tng) { tngFile = tng; comboBoxMap.SelectedIndex = i; break; } } comboBoxSection.Items.Clear(); if (tng != null) { FableMod.TNG.Section section = things[0].Section; for (int i = 1; i < things.Length; ++i) { if (section != things[i].Section) { section = null; } } for (int i = 0; i < tng.SectionCount; ++i) { SectionComboBoxItem item = new SectionComboBoxItem( tng.get_Sections(i)); int index = comboBoxSection.Items.Add(item); if (item.mySection == section) { comboBoxSection.SelectedIndex = index; } } } } }