DBCViewer.DefinitionSelect.SetDefinitions C# (CSharp) Method

SetDefinitions() public method

public SetDefinitions ( IEnumerabledefinitions ) : void
definitions IEnumerable
return void
        public void SetDefinitions(IEnumerable<Table> definitions)
        {
            foreach (Table def in definitions)
            {
                var item = string.Format(CultureInfo.InvariantCulture, "{0} (build {1})", def.Name, def.Build);
                listBox1.Items.Add(item);
            }

            listBox1.SelectedIndex = 0;
        }

Usage Example

示例#1
0
        private Table GetDefinition()
        {
            var definitions = m_definitions.Tables.Where(t => t.Name == m_dbcName);

            if (!definitions.Any())
            {
                definitions = m_definitions.Tables.Where(t => t.Name == Path.GetFileName(m_dbcFile));
            }

            if (!definitions.Any())
            {
                return(null);
            }
            else if (definitions.Count() == 1)
            {
                return(definitions.First());
            }
            else
            {
                m_selector = new DefinitionSelect();
                m_selector.SetDefinitions(definitions);
                var result = m_selector.ShowDialog();
                if (result != DialogResult.OK || m_selector.DefinitionIndex == -1)
                {
                    return(null);
                }
                return(definitions.ElementAt(m_selector.DefinitionIndex));
            }
        }
All Usage Examples Of DBCViewer.DefinitionSelect::SetDefinitions
EN | RU | DE | FR | ES | PT | IT | JP | ZH | KO