private void button1_Click(object sender, EventArgs e) { var testDialog = new AddCategoryDialog(); if (testDialog.ShowDialog(this) != DialogResult.OK) { ChanelsRepository.Create(testDialog.Name); } testDialog.Dispose(); Form.UpdatePanel(); }
public void UpdatePanel() { controlPanel.Controls.Clear(); categories = ChanelsRepository.Read(); foreach (var category in categories) { controlPanel.Controls.Add(new Button { Text = category.Name, Size = new Size(225, 40) }); } controlPanel.Controls.Add(new AddButton(this)); }