private void ClearSelection() { foreach (var selectedIndex in ItemListBox.CheckedIndices) { int idx = (int)selectedIndex; ItemListBox.SetItemChecked(idx, false); } }
private void cmb_equip_type_SelectionChanged(object sender, SelectionChangedEventArgs e) { now_DB = SelectedItemType(); InitializeContents(); BindingItemList = new ItemListBox(ref now_DB); DB_ListBox.ItemsSource = BindingItemList; SetNowItemOption(); }
public ItemManager(ref DBlist DB) { _DB = DB; InitializeComponent(); DataContext = now_item; cmb_equip_type.SelectedIndex = 3; now_DB = SelectedItemType(); InitializeContents(); BindingItemList = new ItemListBox(ref now_DB); DB_ListBox.ItemsSource = BindingItemList; //SetNowItemOption(); SetComboBox(); }
/// <summary> /// Resets the UI each time the dialogue box is loaded. /// </summary> /// <param name="inSender">The originator of the event.</param> /// <param name="inEventArguments">Additional event data.</param> private void AddSlotBox_Load(object inSender, EventArgs inEventArguments) { ReturnNewSlot = InventorySlot.Empty; ItemID = ModelID.None; ItemAmount = 0; AmountTextBox.Text = ""; ItemListBox.SelectedItem = null; ItemListBox.BeginUpdate(); ItemListBox.Items.Clear(); ItemListBox.Items.AddRange(All.Items.Where(model => model.ID != ModelID.None).ToArray <object>()); ItemListBox.EndUpdate(); ApplyCurrentTheme(); ItemListBox.Select(); }
private void UpdateItemInfo() { var items = itemDTOs.Select ( item => new { Key = item.m_ID + ": " + _translations.Where(t => t.Key == "ITEM_" + item.m_ID + "_NAME").FirstOrDefault()?.Element.m_Translations[activeLanguage], Value = item } ).ToList(); ItemListBox.SelectedIndexChanged -= ItemListBox_SelectedIndexChanged; ItemListBox.DataSource = items; ItemListBox.DisplayMember = "Key"; ItemListBox.ValueMember = "Value"; ItemListBox.ClearSelected(); ItemListBox.SelectedIndexChanged += ItemListBox_SelectedIndexChanged; UpdateAbilityInfo(); UpdateModifierInfo(); }
public ItemBrowser() { SRMapper.LanguageMapper(); InitializeComponent(); ItemListBox.ClearSelected(); _translations = FileManager.LoadTranslationsXML("Translations.xml", FileManager.ExecPath).ToList(); itemDTOs = FileManager.LoadItemDataXML("ItemData.xml", FileManager.ExecPath).OrderBy(i => i.m_ID).ToList(); UpdateItemInfo(); ItemSlotTypeDropDown.DataSource = Enum.GetValues(typeof(ItemSlotTypes)).Cast <ItemSlotTypes>().ToList().Take(8).ToList(); GearSubTypeDropDown.DataSource = Enum.GetValues(typeof(ItemSubCategories)); //.Cast<ItemSubCategories>().ToList().Take(8).ToList(); WeaponTypeDropDown.DataSource = Enum.GetValues(typeof(WeaponType)).Cast <WeaponType>().ToList().Take(29).ToList(); abilities = _translations.Where(t => t.Key.StartsWith("ABILITY_") && t.Key.EndsWith("_NAME")).Select(a => { int id = int.Parse(a.Key.Replace("ABILITY_", "").Replace("_NAME", "")); LocElement desc = null; if (_translations.Where(t => t.Key == "ABILITY_" + id + "_DESC").Any()) { desc = _translations.Where(t => t.Key == "ABILITY_" + id + "_DESC").First().Element; } return(new Models.Ability() { Id = id, LocName = a.Element, LocDesc = desc }); }).ToList(); AbilityDropdown.DataSource = abilities; AbilityDropdown.DisplayMember = "Name"; AbilityDropdown.ValueMember = "Desc"; ModifierDropdown.DataSource = Enum.GetValues(typeof(ModifierType)).Cast <ModifierType>().ToList().Skip(1).ToList(); //MultiplierTypeDropDown.DataSource = Enum.GetValues(typeof(ModifierType)).Cast<ModifierType>().ToList(); }