From c2c16266198f152624ebad8edfb1ab982ee27908 Mon Sep 17 00:00:00 2001 From: KoalaBear Date: Fri, 3 Dec 2021 15:09:08 +0100 Subject: [PATCH] - Show version in settings screen - Press ESC to close Settings --- src/HAClimateDeskband/FormSettings.Designer.cs | 2 ++ src/HAClimateDeskband/FormSettings.cs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/HAClimateDeskband/FormSettings.Designer.cs b/src/HAClimateDeskband/FormSettings.Designer.cs index 8ffb55a..f1ca576 100644 --- a/src/HAClimateDeskband/FormSettings.Designer.cs +++ b/src/HAClimateDeskband/FormSettings.Designer.cs @@ -187,12 +187,14 @@ private void InitializeComponent() this.Controls.Add(this.BtnSave); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.KeyPreview = true; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormSettings"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "HA Climate DeskBand"; this.Load += new System.EventHandler(this.FormSettings_Load); + this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.FormSettings_KeyPress); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HAClimateDeskband/FormSettings.cs b/src/HAClimateDeskband/FormSettings.cs index baf28d4..8ebf6b6 100644 --- a/src/HAClimateDeskband/FormSettings.cs +++ b/src/HAClimateDeskband/FormSettings.cs @@ -11,6 +11,8 @@ public partial class FormSettings : Form public FormSettings() { InitializeComponent(); + + Text += $" {typeof(FormSettings).Assembly.GetName().Version}"; } private void FormSettings_Load(object sender, EventArgs e) @@ -53,5 +55,13 @@ private void BtnSave_Click(object sender, EventArgs e) HAClimateDeskband.LoadSettings(); Close(); } + + private void FormSettings_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == Convert.ToChar(Keys.Escape)) + { + Close(); + } + } } }