From a70f4f4393d56aef02f7a02b593588de3ec69209 Mon Sep 17 00:00:00 2001
From: JFronny <33260128+JFronny@users.noreply.github.com>
Date: Fri, 12 Jun 2020 12:20:04 +0200
Subject: [PATCH] Call CalculatePosition if CenteredScreen.Title gets changed
---
Commandline/TUI/CenteredScreen.cs | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/Commandline/TUI/CenteredScreen.cs b/Commandline/TUI/CenteredScreen.cs
index 928689b..f1f51cb 100644
--- a/Commandline/TUI/CenteredScreen.cs
+++ b/Commandline/TUI/CenteredScreen.cs
@@ -21,11 +21,7 @@ namespace CC_Functions.Commandline.TUI
///
public Panel ContentPanel;
- ///
- /// The title to display at the top of the console
- ///
- public string Title = "CC-Functions.CommandLine app";
-
+ private string _title = "CC-Functions.CommandLine app";
private readonly Label _titleLabel;
///
@@ -47,6 +43,22 @@ namespace CC_Functions.Commandline.TUI
CalculatePosition(true);
}
+ ///
+ /// The title to display at the top of the console
+ ///
+ public string Title
+ {
+ get => _title;
+ set
+ {
+ if (_title != value && !string.IsNullOrWhiteSpace(value))
+ {
+ _title = value;
+ CalculatePosition();
+ }
+ }
+ }
+
///
/// Calculates the Size variable, Title and ContentPanel position/size
///