예제 #1
0
        public DlgSearch()
        {
            InitializeComponent();
            guiResultLbl.Text      = "";
            m_columns              = null;
            m_adjustedColumnWidths = false;
            m_dlgSearchCriteria    = null;

            // Create an instance of a ListView column sorter and assign it
            // to the ListView control.
            lvwColumnSorter = new ListViewColumnSorter();
            guiResultTbl.ListViewItemSorter = lvwColumnSorter;
        }
예제 #2
0
        public void configure(Net7.Tables table)
        {
            if (!m_table.Equals(table))
            {
                // Clear the previous search results
                guiSearchCriteriaTbl.Items.Clear();
                guiResultTbl.Items.Clear();
                guiResultLbl.Text = "";
            }

            m_table = table;
            ColumnData.ColumnDataInfo[] fields = null;
            switch (m_table)
            {
            case Net7.Tables.effects:
                m_columns = new Enum[] { Net7.Table_effects._effect_id, Net7.Table_effects._description, Net7.Table_effects._base_asset_id };
                fields    = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_effects>(true);
                break;

            case Net7.Tables.factions:
                m_columns = new Enum[] { Net7.Table_factions._faction_id, Net7.Table_factions._name };
                fields    = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_factions>(true);
                break;

            case Net7.Tables.item_base:
                m_columns = new Enum[] { Net7.Table_item_base._id,
                                         Net7.Table_item_base._name,
                                         Net7.Table_item_base._category,
                                         Net7.Table_item_base._sub_category,
                                         Net7.Table_item_base._level,
                                         Net7.Table_item_base._status };
                fields = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_item_base>(true);
                break;

            case Net7.Tables.missions:
                m_columns = new Enum[] { Net7.Table_missions._mission_id,
                                         Net7.Table_missions._mission_name,
                                         Net7.Table_missions._mission_type,
                                         Net7.Table_missions._mission_key };
                fields = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_missions>(true);
                break;

            case Net7.Tables.mob_base:
                m_columns = new Enum[] { Net7.Table_mob_base._mob_id,
                                         Net7.Table_mob_base._name };
                fields = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_mob_base>(true);
                break;

            case Net7.Tables.starbase_npcs:
                m_columns = new Enum[] { Net7.Table_starbase_npcs._npc_Id,
                                         Net7.Table_starbase_npcs._first_name,
                                         Net7.Table_starbase_npcs._last_name };
                fields = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_starbase_npcs>(true);
                break;

            case Net7.Tables.sectors:
                m_columns = new Enum[] { Net7.Table_sectors._sector_id,
                                         Net7.Table_sectors._name };
                fields = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_sectors>(true);
                break;

            case Net7.Tables.sector_objects:
                m_columns = new Enum[] { Net7.Table_sector_objects._sector_object_id,
                                         Net7.Table_sector_objects._name,
                                         Net7.Table_sector_objects._base_asset_id,
                                         Net7.Table_sector_objects._sector_id };
                fields = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_sector_objects>(true);
                break;

            case Net7.Tables.skills:
                m_columns = new Enum[] { Net7.Table_skills._skill_id,
                                         Net7.Table_skills._name };
                fields = CommonTools.Enumeration.ToColumnDataInfo <Net7.Table_skills>(true);
                break;

            default:
                throw (new Exception("DlgSearch.configure() does not handle the table " + table.ToString()));
            }

            guiResultTbl.Columns.Clear();
            m_adjustedColumnWidths = false;

            ColumnHeader columnHeader;

            for (int columnIndex = 0; columnIndex < m_columns.Length; columnIndex++)
            {
                columnHeader = new ColumnHeader();
                columnHeader.DisplayIndex = columnIndex;
                columnHeader.Text         = ColumnData.GetName(m_columns[columnIndex]);
                columnHeader.Width        = -2;
                guiResultTbl.Columns.Add(columnHeader);
            }

            m_dlgSearchCriteria = new DlgSearchCriteria();
            m_dlgSearchCriteria.configure(fields);
        }