コード例 #1
0
        private void LoadDatabaseFiles()
        {
            databasesListView.BeginUpdate();
            try
            {
                databasesListView.Items.Clear();

                foreach (string databaseFile in DataSetManager.GetAllDatabaseFiles())
                {
                    ListViewItem item = new ListViewItem();
                    item.Text       = Path.GetFileNameWithoutExtension(databaseFile);
                    item.Tag        = ItemDefinition.FromDataSet(databaseFile);
                    item.ImageIndex = 0;
                    databasesListView.Items.Add(item);
                }

                foreach (AddInDefinition addInDefinition in AddInManager.AddInDefinitions)
                {
                    if (!addInDefinition.HasErrors)
                    {
                        ListViewItem item = new ListViewItem();
                        item.Text       = addInDefinition.Instance.Name;
                        item.Tag        = ItemDefinition.FromAddInDefinition(addInDefinition);
                        item.ImageIndex = 1;
                        databasesListView.Items.Add(item);
                    }
                }

                if (databasesListView.Items.Count > 0)
                {
                    databasesListView.Items[0].Selected = true;
                    databasesListView.Items[0].Focused  = true;
                }
            }
            finally
            {
                databasesListView.EndUpdate();
            }
        }