From 10952769aa1b2f4e12cbb817ab60180f445163f1 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 12 Jul 2022 20:50:42 +0200 Subject: [PATCH] Manage the current selected section --- .../UI WinForms/Components/TextElements.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/I18N Commander/UI WinForms/Components/TextElements.cs b/I18N Commander/UI WinForms/Components/TextElements.cs index 3da6153..694aec8 100644 --- a/I18N Commander/UI WinForms/Components/TextElements.cs +++ b/I18N Commander/UI WinForms/Components/TextElements.cs @@ -1,9 +1,20 @@ -namespace UI_WinForms.Components; +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; + }; } } \ No newline at end of file