using DataModel.Database; namespace UI_WinForms.Components; public partial class TextElements : UserControl { private Section? currentSection; public TextElements() { this.InitializeComponent(); // When the section is changed, update this component: AppEvents.WhenSectionChanged += (sender, section) => { this.currentSection = section; this.buttonAdd.Enabled = this.currentSection is not null; }; } }