private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text.Equals("", StringComparison.OrdinalIgnoreCase) && listBox2.SelectedIndex != -1) { if ((listBox2.SelectedItem as String).Equals("None", StringComparison.OrdinalIgnoreCase)) { listBox1.DataSource = null; listBox1.DataSource = (MapBuilder.gcDB.gameItems).ToArray(); } else { BaseItem.ITEM_TYPES type = (BaseItem.ITEM_TYPES)listBox2.SelectedIndex; listBox1.DataSource = null; listBox1.DataSource = (MapBuilder.gcDB.gameItems.FindAll(i => i.itemType == type).ToList()); } } else if (!textBox1.Text.Equals("", StringComparison.OrdinalIgnoreCase)) { //listBox1.DataSource = null; // listBox1.Items.AddRange(MapBuilder.loadedMap.mapRegions.FindAll(r => r.regionName.IndexOf(textBox1.Text, StringComparison.OrdinalIgnoreCase) >= 0).ToArray()); //listBox1.DataSource = (MapBuilder.gcDB.gameItems.FindAll(i => i.itemType == BaseItem.ITEM_TYPES.Equipment).Cast<BaseEquipment>().ToList().FindAll(i => i.EquipType == selectedItemType).FindAll(i => i.itemName.IndexOf(textBox1.Text, StringComparison.OrdinalIgnoreCase) >= 0)); if ((listBox2.SelectedItem as String).Equals("None", StringComparison.OrdinalIgnoreCase)) { listBox1.DataSource = null; listBox1.DataSource = (MapBuilder.gcDB.gameItems).FindAll(i => i.itemName.IndexOf(textBox1.Text, StringComparison.OrdinalIgnoreCase) >= 0); } else { BaseItem.ITEM_TYPES type = (BaseItem.ITEM_TYPES)listBox2.SelectedIndex; listBox1.DataSource = null; listBox1.DataSource = MapBuilder.gcDB.gameItems.FindAll(i => i.itemType == type).FindAll(i => i.itemName.IndexOf(textBox1.Text, StringComparison.OrdinalIgnoreCase) >= 0); } } }
public void Start(BaseItem.ITEM_TYPES biit, List <int> list) { Show(); selectedItemType = biit; listToAddTo = list; listBox1.Items.AddRange(MapBuilder.gcDB.gameItems.FindAll(i => i.itemType == selectedItemType).ToArray()); listBox2.DataSource = listToAddTo; }