Ejemplo n.º 1
0
        public frmItems()
        {
            InitializeComponent();

            this.Text = this.Text + CommonTools.Gui.LoginData.ApplicationVersion;

            listEditors       = new System.Collections.Generic.Dictionary <EditorType, IEditor>();
            listSearchDialogs = new Dictionary <SearchDialog, ISearchDialog>();
            listSearchDialogs.Add(SearchDialog.Item, m_itemSearch);

            Restrictions.setRestrictions(chkTerranRest, chkJenquaiRest, chkProjenRest, raceRestrictionsLbl,
                                         chkWarriorRest, chkTraderRest, chkExplorerRest, professionRestrictionsLbl);

            TableIO itemsTableIO         = initializeItems();
            TableIO ammoTableIO          = initializeItemAmmo();
            TableIO beamTableIO          = initializeItemBeam();
            TableIO projectileTableIO    = initializeProjectile();
            TableIO missileTableIO       = initializeMissile();
            TableIO deviceTableIO        = initializeDevice();
            TableIO engineTableIO        = initializeEngine();
            TableIO reactorTableIO       = initializeReactor();
            TableIO shieldTableIO        = initializeShield();
            TableIO manufacturingTableIO = initializeItemManufacturing(m_itemSearch);

            manufacturingTableIO.setRecordOptional();

            // Ungrouped tables
            m_tableEditor.add(SingleTableEditor.Manufacturing, manufacturingTableIO);

            // Ammo
            ItemEditor itemEditor = new ItemEditor(m_itemSearch);

            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabAmmo, ammoTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Ammo, itemEditor);

            // Beam
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabBeam, beamTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Beam, itemEditor);

            // Projectile
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabProjectile, projectileTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Projectile, itemEditor);

            // Missile
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabMissile, missileTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Missile, itemEditor);

            // Device
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabDevice, deviceTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Device, itemEditor);

            // Engine
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabEngine, engineTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Engine, itemEditor);

            // Reactor
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabRS, reactorTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Reactor, itemEditor);

            // Shield
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabRS, shieldTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Shield, itemEditor);

            // Component
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items, itemEditor);

            // Select the default editor
            setEditor(EditorType.Items, true);
        }