using LibW4M.Data.Teams; using LibW4M.Data.WeaponFactory; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using W4Gui.Components; namespace W4Gui.Tabs { public partial class WeaponsTab : TabEntry { public override void SaveFromControl() { if(weaponList.List.IsItemSelected) weaponList_Unselected(null, null); } public override void LoadIntoControl() { weaponList.List.LoadCollective(DataManager.SaveFile.WeaponFactoryCollective); weaponClusterTabControl.Enabled = false; } public WeaponsTab() { InitializeComponent(); } private void weaponList_Unselected(object sender, EventArgs e) { WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[weaponList.List.LastSelected] as WeaponStore; weaponPanel.SaveWeaponData(ref store.Weapon); clusterPanel.SaveWeaponData(ref store.Cluster); weaponList.List.UpdateName(weaponList.List.LastSelected, store.Weapon.Name.Value); } private void weaponList_Selected(object sender, EventArgs e) { WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[weaponList.List.CurrentlySelected] as WeaponStore; weaponPanel.LoadWeaponData(store.Weapon); clusterPanel.LoadWeaponData(store.Cluster); weaponClusterTabControl.Enabled = true; } private void weaponList_NewButton(object sender, EventArgs e) { throw new NotImplementedException("Adding new weapons from here not implemented yet ;)"); } private void weaponList_DeleteButton(object sender, EventArgs e) { throw new NotImplementedException("Removing weapons from here not implemented yet ;)"); int sel = weaponList.List.CurrentlySelected; WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[sel] as WeaponStore; DataManager.SaveFile.WeaponFactoryCollective.Delete(store); weaponList.List.Delete(sel); } } }