private void LoadCategories() { var categories = new List <ListViewItem>(); _categories.Clear(); CategoryList.Items.Clear(); DBRequests.MakeRequest(DBRequests.LoadCategories(), (connection, sqlCommand) => { using (var reader = sqlCommand.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { var textInstance = new TextInstance { ID = reader.GetInt32(1), Name = reader.GetString(0) }; _categories.Add(textInstance); categories.Add(new ListViewItem(textInstance.Name)); } } CategoryList.Alignment = ListViewAlignment.Left; CategoryList.Dock = DockStyle.Fill; CategoryList.View = View.List; // Initialize the tile size. CategoryList.TileSize = new Size(100, 25); CategoryList.Items.AddRange(categories.ToArray()); } }); }
private void LoadAlbums() { _albums.Clear(); AlbumCombo.Items.Clear(); DBRequests.MakeRequest(DBRequests.LoadAlbums(), (connection, sqlCommand) => { using (var reader = sqlCommand.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { var textInstance = new TextInstance { ID = reader.GetInt32(1), Name = reader.GetString(0) }; _albums.Add(textInstance); } } AlbumCombo.Items.AddRange(_albums.ToArray()); } }); }