From 1de413c227e68961ff58cbb302eaee5ea3901574 Mon Sep 17 00:00:00 2001 From: LAB02 Research Date: Sat, 2 Apr 2022 19:38:45 +0200 Subject: [PATCH] b2022.4.2 --- .../Configuration/ConfigGeneral.Designer.cs | 54 +++- .../Controls/Configuration/ConfigGeneral.cs | 16 +- .../ConfigHomeAssistantApi.Designer.cs | 16 +- .../Configuration/ConfigHotKey.Designer.cs | 10 +- .../ConfigLocalStorage.Designer.cs | 10 +- .../Configuration/ConfigLogging.Designer.cs | 10 +- .../Configuration/ConfigMqtt.Designer.cs | 21 +- .../ConfigNotifications.Designer.cs | 20 +- .../Configuration/ConfigService.Designer.cs | 36 +-- .../Configuration/ConfigStartup.Designer.cs | 15 +- .../Configuration/ConfigUpdates.Designer.cs | 12 +- .../Onboarding-1-Welcome.Designer.cs | 45 +++- .../Onboarding/Onboarding-1-Welcome.cs | 68 ++++- .../Onboarding-2-Startup.Designer.cs | 6 +- .../Onboarding/Onboarding-6-MQTT.Designer.cs | 6 +- .../Service/ServiceCommands.Designer.cs | 22 +- .../Controls/Service/ServiceCommands.resx | 2 +- .../Service/ServiceGeneral.Designer.cs | 62 +++-- .../Controls/Service/ServiceMQTT.Designer.cs | 24 +- .../Controls/Service/ServiceMqtt.cs | 13 +- .../Service/ServiceSensors.Designer.cs | 22 +- .../Controls/Service/ServiceSensors.resx | 2 +- src/HASS.Agent/Forms/About.Designer.cs | 28 +- .../PortReservation.Designer.cs | 6 +- .../ChildApplications/PortReservation.cs | 5 +- .../ChildApplications/PostUpdate.Designer.cs | 6 +- .../Forms/ChildApplications/PostUpdate.cs | 5 +- .../ChildApplications/Restart.Designer.cs | 6 +- .../Forms/ChildApplications/Restart.cs | 6 +- .../ServiceReinstall.Designer.cs | 6 +- .../ChildApplications/ServiceReinstall.cs | 5 +- .../ServiceSetState.Designer.cs | 6 +- .../ChildApplications/ServiceSetState.cs | 5 +- .../Forms/Commands/CommandMqttTopic.cs | 10 +- .../Forms/Commands/CommandsConfig.Designer.cs | 22 +- .../Forms/Commands/CommandsConfig.resx | 2 +- .../Forms/Commands/CommandsMod.Designer.cs | 12 +- .../Forms/Commands/CommandsMod.resx | 2 +- src/HASS.Agent/Forms/Configuration.cs | 6 +- src/HASS.Agent/Forms/Help.Designer.cs | 40 +-- src/HASS.Agent/Forms/Main.Designer.cs | 80 +++--- src/HASS.Agent/Forms/Main.cs | 16 +- src/HASS.Agent/Forms/Onboarding.cs | 11 + .../QuickActions/QuickActionsMod.Designer.cs | 16 +- .../Forms/Sensors/SensorsConfig.Designer.cs | 16 +- .../Forms/Sensors/SensorsConfig.resx | 2 +- .../Forms/Sensors/SensorsMod.Designer.cs | 10 +- src/HASS.Agent/Forms/Sensors/SensorsMod.resx | 2 +- .../Forms/UpdatePending.Designer.cs | 8 +- src/HASS.Agent/Functions/HelperFunctions.cs | 1 + .../Functions/LocalizationManager.cs | 152 +++++++++++ src/HASS.Agent/Functions/OnboardingManager.cs | 51 ++-- src/HASS.Agent/HASS.Agent.csproj | 2 +- src/HASS.Agent/Models/Config/AppSettings.cs | 1 + .../Models/Internal/SupportedUILanguage.cs | 30 +++ src/HASS.Agent/Program.cs | 41 ++- .../Localization/Languages.pt-br.resx | 240 ++++++++++-------- src/HASS.Agent/Settings/SettingsManager.cs | 55 ++-- src/HASS.Agent/Variables.cs | 7 + 59 files changed, 920 insertions(+), 491 deletions(-) create mode 100644 src/HASS.Agent/Functions/LocalizationManager.cs create mode 100644 src/HASS.Agent/Models/Internal/SupportedUILanguage.cs diff --git a/src/HASS.Agent/Controls/Configuration/ConfigGeneral.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigGeneral.Designer.cs index 2aec133..70d9943 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigGeneral.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigGeneral.Designer.cs @@ -40,6 +40,8 @@ private void InitializeComponent() this.TbDeviceName = new System.Windows.Forms.TextBox(); this.LblDeviceName = new System.Windows.Forms.Label(); this.NumDisconnectGrace = new Syncfusion.Windows.Forms.Tools.NumericUpDownExt(); + this.LblInterfaceLangauge = new System.Windows.Forms.Label(); + this.CbLanguage = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.NumDisconnectGrace)).BeginInit(); this.SuspendLayout(); // @@ -47,7 +49,7 @@ private void InitializeComponent() // this.LblInfo4.AutoSize = true; this.LblInfo4.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo4.Location = new System.Drawing.Point(73, 350); + this.LblInfo4.Location = new System.Drawing.Point(73, 444); this.LblInfo4.Name = "LblInfo4"; this.LblInfo4.Size = new System.Drawing.Size(550, 38); this.LblInfo4.TabIndex = 63; @@ -57,7 +59,7 @@ private void InitializeComponent() // this.LblDisconGraceSeconds.AutoSize = true; this.LblDisconGraceSeconds.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblDisconGraceSeconds.Location = new System.Drawing.Point(171, 428); + this.LblDisconGraceSeconds.Location = new System.Drawing.Point(171, 522); this.LblDisconGraceSeconds.Name = "LblDisconGraceSeconds"; this.LblDisconGraceSeconds.Size = new System.Drawing.Size(58, 19); this.LblDisconGraceSeconds.TabIndex = 62; @@ -67,7 +69,7 @@ private void InitializeComponent() // this.LblDisconGracePeriod.AutoSize = true; this.LblDisconGracePeriod.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblDisconGracePeriod.Location = new System.Drawing.Point(70, 404); + this.LblDisconGracePeriod.Location = new System.Drawing.Point(70, 498); this.LblDisconGracePeriod.Name = "LblDisconGracePeriod"; this.LblDisconGracePeriod.Size = new System.Drawing.Size(169, 19); this.LblDisconGracePeriod.TabIndex = 61; @@ -77,7 +79,7 @@ private void InitializeComponent() // this.LblInfo3.AutoSize = true; this.LblInfo3.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo3.Location = new System.Drawing.Point(73, 221); + this.LblInfo3.Location = new System.Drawing.Point(73, 315); this.LblInfo3.Name = "LblInfo3"; this.LblInfo3.Size = new System.Drawing.Size(586, 57); this.LblInfo3.TabIndex = 59; @@ -87,7 +89,7 @@ private void InitializeComponent() // this.LblInfo2.AutoSize = true; this.LblInfo2.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo2.Location = new System.Drawing.Point(70, 99); + this.LblInfo2.Location = new System.Drawing.Point(70, 193); this.LblInfo2.Name = "LblInfo2"; this.LblInfo2.Size = new System.Drawing.Size(534, 38); this.LblInfo2.TabIndex = 58; @@ -110,7 +112,7 @@ private void InitializeComponent() this.TbDeviceName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.TbDeviceName.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.TbDeviceName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.TbDeviceName.Location = new System.Drawing.Point(73, 174); + this.TbDeviceName.Location = new System.Drawing.Point(73, 268); this.TbDeviceName.Name = "TbDeviceName"; this.TbDeviceName.Size = new System.Drawing.Size(358, 25); this.TbDeviceName.TabIndex = 55; @@ -119,7 +121,7 @@ private void InitializeComponent() // this.LblDeviceName.AutoSize = true; this.LblDeviceName.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblDeviceName.Location = new System.Drawing.Point(70, 152); + this.LblDeviceName.Location = new System.Drawing.Point(70, 246); this.LblDeviceName.Name = "LblDeviceName"; this.LblDeviceName.Size = new System.Drawing.Size(85, 19); this.LblDeviceName.TabIndex = 56; @@ -134,7 +136,7 @@ private void InitializeComponent() this.NumDisconnectGrace.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.NumDisconnectGrace.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.NumDisconnectGrace.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.NumDisconnectGrace.Location = new System.Drawing.Point(73, 426); + this.NumDisconnectGrace.Location = new System.Drawing.Point(73, 520); this.NumDisconnectGrace.Maximum = new decimal(new int[] { 86400, 0, @@ -153,11 +155,39 @@ private void InitializeComponent() 0}); this.NumDisconnectGrace.VisualStyle = Syncfusion.Windows.Forms.VisualStyle.Metro; // - // General + // LblInterfaceLangauge + // + this.LblInterfaceLangauge.AutoSize = true; + this.LblInterfaceLangauge.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.LblInterfaceLangauge.Location = new System.Drawing.Point(70, 95); + this.LblInterfaceLangauge.Name = "LblInterfaceLangauge"; + this.LblInterfaceLangauge.Size = new System.Drawing.Size(121, 19); + this.LblInterfaceLangauge.TabIndex = 65; + this.LblInterfaceLangauge.Text = Languages.ConfigGeneral_LblInterfaceLangauge; + // + // CbLanguage + // + this.CbLanguage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); + this.CbLanguage.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.CbLanguage.DropDownHeight = 300; + this.CbLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CbLanguage.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.CbLanguage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); + this.CbLanguage.FormattingEnabled = true; + this.CbLanguage.IntegralHeight = false; + this.CbLanguage.Location = new System.Drawing.Point(73, 117); + this.CbLanguage.Name = "CbLanguage"; + this.CbLanguage.Size = new System.Drawing.Size(358, 26); + this.CbLanguage.Sorted = true; + this.CbLanguage.TabIndex = 66; + // + // ConfigGeneral // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(48))))); + this.Controls.Add(this.CbLanguage); + this.Controls.Add(this.LblInterfaceLangauge); this.Controls.Add(this.NumDisconnectGrace); this.Controls.Add(this.LblInfo4); this.Controls.Add(this.LblDisconGraceSeconds); @@ -169,8 +199,8 @@ private void InitializeComponent() this.Controls.Add(this.LblDeviceName); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "General"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigGeneral"; + this.Size = new System.Drawing.Size(700, 592); this.Load += new System.EventHandler(this.ConfigGeneral_Load); ((System.ComponentModel.ISupportInitialize)(this.NumDisconnectGrace)).EndInit(); this.ResumeLayout(false); @@ -189,5 +219,7 @@ private void InitializeComponent() private System.Windows.Forms.Label LblDeviceName; internal System.Windows.Forms.TextBox TbDeviceName; internal Syncfusion.Windows.Forms.Tools.NumericUpDownExt NumDisconnectGrace; + private Label LblInterfaceLangauge; + internal ComboBox CbLanguage; } } diff --git a/src/HASS.Agent/Controls/Configuration/ConfigGeneral.cs b/src/HASS.Agent/Controls/Configuration/ConfigGeneral.cs index e55cc4b..e0b7013 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigGeneral.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigGeneral.cs @@ -1,15 +1,27 @@ -namespace HASS.Agent.Controls.Configuration +using System.Globalization; +using HASS.Agent.Functions; +using Syncfusion.Windows.Forms; + +namespace HASS.Agent.Controls.Configuration { public partial class ConfigGeneral : UserControl { public ConfigGeneral() { InitializeComponent(); + + BindComboBoxTheme(); } + private void BindComboBoxTheme() => CbLanguage.DrawItem += ComboBoxTheme.DrawItem; + private void ConfigGeneral_Load(object sender, EventArgs e) { - // + // load all languages + foreach (var lang in Variables.SupportedUILanguages) CbLanguage.Items.Add(lang.DisplayName); + + // select the current one + CbLanguage.SelectedItem = Variables.CurrentUICulture.DisplayName; } } } diff --git a/src/HASS.Agent/Controls/Configuration/ConfigHomeAssistantApi.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigHomeAssistantApi.Designer.cs index 0613f5e..1591832 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigHomeAssistantApi.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigHomeAssistantApi.Designer.cs @@ -45,13 +45,13 @@ private void InitializeComponent() // // LblTip1 // - this.LblTip1.AutoSize = true; this.LblTip1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblTip1.Location = new System.Drawing.Point(471, 340); + this.LblTip1.Location = new System.Drawing.Point(177, 340); this.LblTip1.Name = "LblTip1"; - this.LblTip1.Size = new System.Drawing.Size(191, 15); + this.LblTip1.Size = new System.Drawing.Size(485, 15); this.LblTip1.TabIndex = 57; this.LblTip1.Text = Languages.ConfigHomeAssistantApi_LblTip1; + this.LblTip1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // TbHassClientCertificate // @@ -83,7 +83,7 @@ private void InitializeComponent() this.CbHassAutoClientCertificate.Name = "CbHassAutoClientCertificate"; this.CbHassAutoClientCertificate.Size = new System.Drawing.Size(269, 23); this.CbHassAutoClientCertificate.TabIndex = 54; - this.CbHassAutoClientCertificate.Text = Languages.ConfigHomeAssistantApi_CbHassAutoClientCertificate; + this.CbHassAutoClientCertificate.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigHomeAssistantApi_CbHassAutoClientCertificate; this.CbHassAutoClientCertificate.UseVisualStyleBackColor = true; // // BtnTestApi @@ -103,7 +103,7 @@ private void InitializeComponent() this.BtnTestApi.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnTestApi.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnTestApi.TabIndex = 52; - this.BtnTestApi.Text = Languages.ConfigHomeAssistantApi_BtnTestApi; + this.BtnTestApi.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigHomeAssistantApi_BtnTestApi; this.BtnTestApi.UseVisualStyleBackColor = false; this.BtnTestApi.Click += new System.EventHandler(this.BtnTestApi_Click); // @@ -159,7 +159,7 @@ private void InitializeComponent() this.LblServerUri.TabIndex = 50; this.LblServerUri.Text = Languages.ConfigHomeAssistantApi_LblServerUri; // - // HomeAssistantApi + // ConfigHomeAssistantApi // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -176,8 +176,8 @@ private void InitializeComponent() this.Controls.Add(this.LblServerUri); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "HomeAssistantApi"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigHomeAssistantApi"; + this.Size = new System.Drawing.Size(700, 544); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigHotKey.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigHotKey.Designer.cs index f643541..81f4470 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigHotKey.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigHotKey.Designer.cs @@ -54,7 +54,7 @@ private void InitializeComponent() this.BtnClearHotKey.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnClearHotKey.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnClearHotKey.TabIndex = 18; - this.BtnClearHotKey.Text = Languages.ConfigHotKey_BtnClearHotKey; + this.BtnClearHotKey.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigHotKey_BtnClearHotKey; this.BtnClearHotKey.UseVisualStyleBackColor = false; // // LblInfo1 @@ -86,7 +86,7 @@ private void InitializeComponent() this.CbEnableQuickActionsHotkey.Name = "CbEnableQuickActionsHotkey"; this.CbEnableQuickActionsHotkey.Size = new System.Drawing.Size(197, 23); this.CbEnableQuickActionsHotkey.TabIndex = 15; - this.CbEnableQuickActionsHotkey.Text = Languages.ConfigHotKey_CbEnableQuickActionsHotkey; + this.CbEnableQuickActionsHotkey.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigHotKey_CbEnableQuickActionsHotkey; this.CbEnableQuickActionsHotkey.UseVisualStyleBackColor = true; // // LblHotkeyCombo @@ -99,7 +99,7 @@ private void InitializeComponent() this.LblHotkeyCombo.TabIndex = 14; this.LblHotkeyCombo.Text = Languages.ConfigHotKey_LblHotkeyCombo; // - // HotKey + // ConfigHotKey // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -111,8 +111,8 @@ private void InitializeComponent() this.Controls.Add(this.LblHotkeyCombo); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "HotKey"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigHotKey"; + this.Size = new System.Drawing.Size(700, 544); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigLocalStorage.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigLocalStorage.Designer.cs index c5d57c1..34c43e3 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigLocalStorage.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigLocalStorage.Designer.cs @@ -57,7 +57,7 @@ private void InitializeComponent() this.BtnClearImageCache.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnClearImageCache.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnClearImageCache.TabIndex = 36; - this.BtnClearImageCache.Text = Languages.ConfigLocalStorage_BtnClearImageCache; + this.BtnClearImageCache.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigLocalStorage_BtnClearImageCache; this.BtnClearImageCache.UseVisualStyleBackColor = false; this.BtnClearImageCache.Click += new System.EventHandler(this.BtnClearImageCache_Click); // @@ -78,7 +78,7 @@ private void InitializeComponent() this.BtnOpenImageCache.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnOpenImageCache.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnOpenImageCache.TabIndex = 35; - this.BtnOpenImageCache.Text = Languages.ConfigLocalStorage_BtnOpenImageCache; + this.BtnOpenImageCache.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigLocalStorage_BtnOpenImageCache; this.BtnOpenImageCache.UseVisualStyleBackColor = false; this.BtnOpenImageCache.Click += new System.EventHandler(this.BtnOpenImageCache_Click); // @@ -152,7 +152,7 @@ private void InitializeComponent() 0}); this.NumImageRetention.VisualStyle = Syncfusion.Windows.Forms.VisualStyle.Metro; // - // LocalStorage + // ConfigLocalStorage // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -166,8 +166,8 @@ private void InitializeComponent() this.Controls.Add(this.LblInfo1); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "LocalStorage"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigLocalStorage"; + this.Size = new System.Drawing.Size(700, 544); ((System.ComponentModel.ISupportInitialize)(this.NumImageRetention)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigLogging.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigLogging.Designer.cs index 3f42676..79f2fc7 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigLogging.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigLogging.Designer.cs @@ -54,7 +54,7 @@ private void InitializeComponent() this.CbExtendedLogging.Name = "CbExtendedLogging"; this.CbExtendedLogging.Size = new System.Drawing.Size(178, 23); this.CbExtendedLogging.TabIndex = 30; - this.CbExtendedLogging.Text = Languages.ConfigLogging_CbExtendedLogging; + this.CbExtendedLogging.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigLogging_CbExtendedLogging; this.CbExtendedLogging.UseVisualStyleBackColor = true; // // BtnShowLogs @@ -74,11 +74,11 @@ private void InitializeComponent() this.BtnShowLogs.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnShowLogs.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnShowLogs.TabIndex = 47; - this.BtnShowLogs.Text = Languages.ConfigLogging_BtnShowLogs; + this.BtnShowLogs.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigLogging_BtnShowLogs; this.BtnShowLogs.UseVisualStyleBackColor = false; this.BtnShowLogs.Click += new System.EventHandler(this.BtnShowLogs_Click); // - // Logging + // ConfigLogging // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -88,8 +88,8 @@ private void InitializeComponent() this.Controls.Add(this.CbExtendedLogging); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Logging"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigLogging"; + this.Size = new System.Drawing.Size(700, 544); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigMqtt.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigMqtt.Designer.cs index 6e430da..f63e7cd 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigMqtt.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigMqtt.Designer.cs @@ -61,11 +61,10 @@ private void InitializeComponent() // // LblTip3 // - this.LblTip3.AutoSize = true; this.LblTip3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblTip3.Location = new System.Drawing.Point(413, 243); this.LblTip3.Name = "LblTip3"; - this.LblTip3.Size = new System.Drawing.Size(205, 15); + this.LblTip3.Size = new System.Drawing.Size(268, 21); this.LblTip3.TabIndex = 64; this.LblTip3.Text = Languages.ConfigMqtt_LblTip3; // @@ -121,7 +120,7 @@ private void InitializeComponent() this.CbUseRetainFlag.Name = "CbUseRetainFlag"; this.CbUseRetainFlag.Size = new System.Drawing.Size(114, 23); this.CbUseRetainFlag.TabIndex = 59; - this.CbUseRetainFlag.Text = Languages.ConfigMqtt_CbUseRetainFlag; + this.CbUseRetainFlag.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigMqtt_CbUseRetainFlag; this.CbUseRetainFlag.UseVisualStyleBackColor = true; // // CbAllowUntrustedCertificates @@ -132,7 +131,7 @@ private void InitializeComponent() this.CbAllowUntrustedCertificates.Name = "CbAllowUntrustedCertificates"; this.CbAllowUntrustedCertificates.Size = new System.Drawing.Size(191, 23); this.CbAllowUntrustedCertificates.TabIndex = 58; - this.CbAllowUntrustedCertificates.Text = Languages.ConfigMqtt_CbAllowUntrustedCertificates; + this.CbAllowUntrustedCertificates.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigMqtt_CbAllowUntrustedCertificates; this.CbAllowUntrustedCertificates.UseVisualStyleBackColor = true; // // BtnMqttClearConfig @@ -141,7 +140,7 @@ private void InitializeComponent() this.BtnMqttClearConfig.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.BtnMqttClearConfig.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.BtnMqttClearConfig.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.BtnMqttClearConfig.Location = new System.Drawing.Point(496, 499); + this.BtnMqttClearConfig.Location = new System.Drawing.Point(453, 498); this.BtnMqttClearConfig.Name = "BtnMqttClearConfig"; this.BtnMqttClearConfig.Size = new System.Drawing.Size(228, 31); this.BtnMqttClearConfig.Style.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); @@ -152,7 +151,7 @@ private void InitializeComponent() this.BtnMqttClearConfig.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnMqttClearConfig.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnMqttClearConfig.TabIndex = 57; - this.BtnMqttClearConfig.Text = Languages.ConfigMqtt_BtnMqttClearConfig; + this.BtnMqttClearConfig.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigMqtt_BtnMqttClearConfig; this.BtnMqttClearConfig.UseVisualStyleBackColor = false; this.BtnMqttClearConfig.Click += new System.EventHandler(this.BtnMqttClearConfig_Click); // @@ -235,7 +234,7 @@ private void InitializeComponent() // this.CbMqttTls.AutoSize = true; this.CbMqttTls.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.CbMqttTls.Location = new System.Drawing.Point(197, 215); + this.CbMqttTls.Location = new System.Drawing.Point(218, 215); this.CbMqttTls.Name = "CbMqttTls"; this.CbMqttTls.Size = new System.Drawing.Size(49, 23); this.CbMqttTls.TabIndex = 46; @@ -323,7 +322,7 @@ private void InitializeComponent() this.NumMqttPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.NumMqttPort.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.NumMqttPort.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.NumMqttPort.Location = new System.Drawing.Point(91, 213); + this.NumMqttPort.Location = new System.Drawing.Point(108, 213); this.NumMqttPort.Maximum = new decimal(new int[] { 65535, 0, @@ -354,7 +353,7 @@ private void InitializeComponent() this.PbShow.TabStop = false; this.PbShow.Click += new System.EventHandler(this.PbShow_Click); // - // MQTT + // ConfigMqtt // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -386,8 +385,8 @@ private void InitializeComponent() this.Controls.Add(this.LblBrokerIp); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "MQTT"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigMqtt"; + this.Size = new System.Drawing.Size(700, 544); this.Load += new System.EventHandler(this.ConfigMqtt_Load); ((System.ComponentModel.ISupportInitialize)(this.NumMqttPort)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PbShow)).EndInit(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigNotifications.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigNotifications.Designer.cs index 301952b..ea296a2 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigNotifications.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigNotifications.Designer.cs @@ -68,7 +68,7 @@ private void InitializeComponent() this.BtnNotificationsReadme.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.BtnNotificationsReadme.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.BtnNotificationsReadme.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.BtnNotificationsReadme.Location = new System.Drawing.Point(493, 497); + this.BtnNotificationsReadme.Location = new System.Drawing.Point(452, 497); this.BtnNotificationsReadme.Name = "BtnNotificationsReadme"; this.BtnNotificationsReadme.Size = new System.Drawing.Size(228, 31); this.BtnNotificationsReadme.Style.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); @@ -79,7 +79,7 @@ private void InitializeComponent() this.BtnNotificationsReadme.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnNotificationsReadme.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnNotificationsReadme.TabIndex = 35; - this.BtnNotificationsReadme.Text = Languages.ConfigNotifications_BtnNotificationsReadme; + this.BtnNotificationsReadme.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigNotifications_BtnNotificationsReadme; this.BtnNotificationsReadme.UseVisualStyleBackColor = false; this.BtnNotificationsReadme.Click += new System.EventHandler(this.BtnNotificationsReadme_Click); // @@ -87,7 +87,7 @@ private void InitializeComponent() // this.LblPort.AutoSize = true; this.LblPort.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblPort.Location = new System.Drawing.Point(220, 102); + this.LblPort.Location = new System.Drawing.Point(200, 102); this.LblPort.Name = "LblPort"; this.LblPort.Size = new System.Drawing.Size(35, 19); this.LblPort.TabIndex = 34; @@ -101,7 +101,7 @@ private void InitializeComponent() this.CbAcceptNotifications.Name = "CbAcceptNotifications"; this.CbAcceptNotifications.Size = new System.Drawing.Size(145, 23); this.CbAcceptNotifications.TabIndex = 33; - this.CbAcceptNotifications.Text = Languages.ConfigNotifications_CbAcceptNotifications; + this.CbAcceptNotifications.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigNotifications_CbAcceptNotifications; this.CbAcceptNotifications.UseVisualStyleBackColor = true; // // NumNotificationApiPort @@ -149,7 +149,7 @@ private void InitializeComponent() this.BtnSendTestNotification.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnSendTestNotification.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnSendTestNotification.TabIndex = 73; - this.BtnSendTestNotification.Text = Languages.ConfigNotifications_BtnSendTestNotification; + this.BtnSendTestNotification.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigNotifications_BtnSendTestNotification; this.BtnSendTestNotification.UseVisualStyleBackColor = false; this.BtnSendTestNotification.Click += new System.EventHandler(this.BtnSendTestNotification_Click); // @@ -170,7 +170,7 @@ private void InitializeComponent() this.BtnExecutePortReservation.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnExecutePortReservation.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnExecutePortReservation.TabIndex = 74; - this.BtnExecutePortReservation.Text = Languages.ConfigNotifications_BtnExecutePortReservation; + this.BtnExecutePortReservation.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigNotifications_BtnExecutePortReservation; this.BtnExecutePortReservation.UseVisualStyleBackColor = false; this.BtnExecutePortReservation.Click += new System.EventHandler(this.BtnExecutePortReservation_Click); // @@ -182,10 +182,10 @@ private void InitializeComponent() this.CbNotificationsIgnoreImageCertErrors.Name = "CbNotificationsIgnoreImageCertErrors"; this.CbNotificationsIgnoreImageCertErrors.Size = new System.Drawing.Size(237, 23); this.CbNotificationsIgnoreImageCertErrors.TabIndex = 75; - this.CbNotificationsIgnoreImageCertErrors.Text = Languages.ConfigNotifications_CbNotificationsIgnoreImageCertErrors; + this.CbNotificationsIgnoreImageCertErrors.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigNotifications_CbNotificationsIgnoreImageCertErrors; this.CbNotificationsIgnoreImageCertErrors.UseVisualStyleBackColor = true; // - // Notifications + // ConfigNotifications // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -201,8 +201,8 @@ private void InitializeComponent() this.Controls.Add(this.CbAcceptNotifications); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Notifications"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigNotifications"; + this.Size = new System.Drawing.Size(700, 544); ((System.ComponentModel.ISupportInitialize)(this.NumNotificationApiPort)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigService.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigService.Designer.cs index e113149..2db45d1 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigService.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigService.Designer.cs @@ -93,7 +93,7 @@ private void InitializeComponent() this.BtnStartService.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStartService.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStartService.TabIndex = 39; - this.BtnStartService.Text = Languages.ConfigService_BtnStartService; + this.BtnStartService.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigService_BtnStartService; this.BtnStartService.UseVisualStyleBackColor = false; this.BtnStartService.Click += new System.EventHandler(this.BtnStartService_Click); // @@ -114,7 +114,7 @@ private void InitializeComponent() this.BtnDisableService.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnDisableService.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnDisableService.TabIndex = 40; - this.BtnDisableService.Text = Languages.ConfigService_BtnDisableService; + this.BtnDisableService.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigService_BtnDisableService; this.BtnDisableService.UseVisualStyleBackColor = false; this.BtnDisableService.Click += new System.EventHandler(this.BtnDisableService_Click); // @@ -135,7 +135,7 @@ private void InitializeComponent() this.BtnStopService.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStopService.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStopService.TabIndex = 41; - this.BtnStopService.Text = Languages.ConfigService_BtnStopService; + this.BtnStopService.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigService_BtnStopService; this.BtnStopService.UseVisualStyleBackColor = false; this.BtnStopService.Click += new System.EventHandler(this.BtnStopService_Click); // @@ -156,7 +156,7 @@ private void InitializeComponent() this.BtnEnableService.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnEnableService.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnEnableService.TabIndex = 42; - this.BtnEnableService.Text = Languages.ConfigService_BtnEnableService; + this.BtnEnableService.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigService_BtnEnableService; this.BtnEnableService.UseVisualStyleBackColor = false; this.BtnEnableService.Click += new System.EventHandler(this.BtnEnableService_Click); // @@ -177,30 +177,30 @@ private void InitializeComponent() this.BtnReinstallService.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnReinstallService.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnReinstallService.TabIndex = 43; - this.BtnReinstallService.Text = Languages.ConfigService_BtnReinstallService; + this.BtnReinstallService.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigService_BtnReinstallService; this.BtnReinstallService.UseVisualStyleBackColor = false; this.BtnReinstallService.Click += new System.EventHandler(this.BtnReinstallService_Click); // // LblInfo2 // - this.LblInfo2.AutoSize = true; this.LblInfo2.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblInfo2.ImageAlign = System.Drawing.ContentAlignment.TopCenter; - this.LblInfo2.Location = new System.Drawing.Point(47, 222); + this.LblInfo2.Location = new System.Drawing.Point(29, 207); this.LblInfo2.Name = "LblInfo2"; - this.LblInfo2.Size = new System.Drawing.Size(646, 38); + this.LblInfo2.Size = new System.Drawing.Size(655, 65); this.LblInfo2.TabIndex = 44; this.LblInfo2.Text = Languages.ConfigService_LblInfo2; + this.LblInfo2.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // LblInfo3 // - this.LblInfo3.AutoSize = true; this.LblInfo3.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo3.Location = new System.Drawing.Point(177, 350); + this.LblInfo3.Location = new System.Drawing.Point(29, 350); this.LblInfo3.Name = "LblInfo3"; - this.LblInfo3.Size = new System.Drawing.Size(386, 38); + this.LblInfo3.Size = new System.Drawing.Size(644, 38); this.LblInfo3.TabIndex = 45; this.LblInfo3.Text = Languages.ConfigService_LblInfo3; + this.LblInfo3.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // BtnShowLogs // @@ -219,7 +219,7 @@ private void InitializeComponent() this.BtnShowLogs.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnShowLogs.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnShowLogs.TabIndex = 46; - this.BtnShowLogs.Text = Languages.ConfigService_BtnShowLogs; + this.BtnShowLogs.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigService_BtnShowLogs; this.BtnShowLogs.UseVisualStyleBackColor = false; this.BtnShowLogs.Click += new System.EventHandler(this.BtnShowLogs_Click); // @@ -248,15 +248,15 @@ private void InitializeComponent() // // LblInfo4 // - this.LblInfo4.AutoSize = true; this.LblInfo4.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo4.Location = new System.Drawing.Point(68, 454); + this.LblInfo4.Location = new System.Drawing.Point(29, 454); this.LblInfo4.Name = "LblInfo4"; - this.LblInfo4.Size = new System.Drawing.Size(605, 19); + this.LblInfo4.Size = new System.Drawing.Size(644, 19); this.LblInfo4.TabIndex = 48; this.LblInfo4.Text = Languages.ConfigService_LblInfo4; + this.LblInfo4.TextAlign = System.Drawing.ContentAlignment.TopCenter; // - // Service + // ConfigService // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -276,8 +276,8 @@ private void InitializeComponent() this.Controls.Add(this.LblInfo1); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Service"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigService"; + this.Size = new System.Drawing.Size(700, 544); this.Load += new System.EventHandler(this.ConfigService_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigStartup.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigStartup.Designer.cs index 0f81e41..0810f2c 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigStartup.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigStartup.Designer.cs @@ -43,7 +43,7 @@ private void InitializeComponent() this.LblInfo1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblInfo1.Location = new System.Drawing.Point(70, 36); this.LblInfo1.Name = "LblInfo1"; - this.LblInfo1.Size = new System.Drawing.Size(579, 76); + this.LblInfo1.Size = new System.Drawing.Size(575, 76); this.LblInfo1.TabIndex = 15; this.LblInfo1.Text = Languages.ConfigStartup_LblInfo1; // @@ -64,19 +64,19 @@ private void InitializeComponent() this.BtnSetStartOnLogin.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnSetStartOnLogin.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnSetStartOnLogin.TabIndex = 14; - this.BtnSetStartOnLogin.Text = Languages.ConfigStartup_BtnSetStartOnLogin; + this.BtnSetStartOnLogin.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigStartup_BtnSetStartOnLogin; this.BtnSetStartOnLogin.UseVisualStyleBackColor = false; this.BtnSetStartOnLogin.Click += new System.EventHandler(this.BtnSetStartOnLogin_Click); // // LblStartOnLoginStatus // - this.LblStartOnLoginStatus.AutoSize = true; this.LblStartOnLoginStatus.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblStartOnLoginStatus.Location = new System.Drawing.Point(398, 205); this.LblStartOnLoginStatus.Name = "LblStartOnLoginStatus"; - this.LblStartOnLoginStatus.Size = new System.Drawing.Size(15, 19); + this.LblStartOnLoginStatus.Size = new System.Drawing.Size(119, 19); this.LblStartOnLoginStatus.TabIndex = 13; this.LblStartOnLoginStatus.Text = "-"; + this.LblStartOnLoginStatus.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // LblStartOnLoginStatusInfo // @@ -87,8 +87,9 @@ private void InitializeComponent() this.LblStartOnLoginStatusInfo.Size = new System.Drawing.Size(139, 19); this.LblStartOnLoginStatusInfo.TabIndex = 12; this.LblStartOnLoginStatusInfo.Text = Languages.ConfigStartup_LblStartOnLoginStatusInfo; + this.LblStartOnLoginStatusInfo.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // Startup + // ConfigStartup // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -99,8 +100,8 @@ private void InitializeComponent() this.Controls.Add(this.LblStartOnLoginStatusInfo); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Startup"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigStartup"; + this.Size = new System.Drawing.Size(700, 544); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Configuration/ConfigUpdates.Designer.cs b/src/HASS.Agent/Controls/Configuration/ConfigUpdates.Designer.cs index a0a367a..44bbe4f 100644 --- a/src/HASS.Agent/Controls/Configuration/ConfigUpdates.Designer.cs +++ b/src/HASS.Agent/Controls/Configuration/ConfigUpdates.Designer.cs @@ -46,7 +46,7 @@ private void InitializeComponent() this.CbBetaUpdates.Name = "CbBetaUpdates"; this.CbBetaUpdates.Size = new System.Drawing.Size(229, 23); this.CbBetaUpdates.TabIndex = 39; - this.CbBetaUpdates.Text = Languages.ConfigUpdates_CbBetaUpdates; + this.CbBetaUpdates.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigUpdates_CbBetaUpdates; this.CbBetaUpdates.UseVisualStyleBackColor = true; // // LblInfo2 @@ -67,7 +67,7 @@ private void InitializeComponent() this.CbExecuteUpdater.Name = "CbExecuteUpdater"; this.CbExecuteUpdater.Size = new System.Drawing.Size(327, 23); this.CbExecuteUpdater.TabIndex = 37; - this.CbExecuteUpdater.Text = Languages.ConfigUpdates_CbExecuteUpdater; + this.CbExecuteUpdater.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigUpdates_CbExecuteUpdater; this.CbExecuteUpdater.UseVisualStyleBackColor = true; // // LblInfo1 @@ -88,10 +88,10 @@ private void InitializeComponent() this.CbUpdates.Name = "CbUpdates"; this.CbUpdates.Size = new System.Drawing.Size(278, 23); this.CbUpdates.TabIndex = 35; - this.CbUpdates.Text = Languages.ConfigUpdates_CbUpdates; + this.CbUpdates.Text = global::HASS.Agent.Resources.Localization.Languages.ConfigUpdates_CbUpdates; this.CbUpdates.UseVisualStyleBackColor = true; // - // Updates + // ConfigUpdates // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -103,8 +103,8 @@ private void InitializeComponent() this.Controls.Add(this.CbUpdates); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Updates"; - this.Size = new System.Drawing.Size(740, 544); + this.Name = "ConfigUpdates"; + this.Size = new System.Drawing.Size(700, 544); this.ResumeLayout(false); this.PerformLayout(); diff --git a/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.Designer.cs b/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.Designer.cs index dccf88c..ef3f933 100644 --- a/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.Designer.cs +++ b/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.Designer.cs @@ -35,6 +35,8 @@ private void InitializeComponent() this.LblInfo2 = new System.Windows.Forms.Label(); this.TbDeviceName = new System.Windows.Forms.TextBox(); this.LblDeviceName = new System.Windows.Forms.Label(); + this.CbLanguage = new System.Windows.Forms.ComboBox(); + this.LblInterfaceLangauge = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.PbHassAgentLogo)).BeginInit(); this.SuspendLayout(); // @@ -63,7 +65,7 @@ private void InitializeComponent() // this.LblInfo2.AutoSize = true; this.LblInfo2.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo2.Location = new System.Drawing.Point(180, 241); + this.LblInfo2.Location = new System.Drawing.Point(177, 332); this.LblInfo2.Name = "LblInfo2"; this.LblInfo2.Size = new System.Drawing.Size(424, 38); this.LblInfo2.TabIndex = 51; @@ -75,26 +77,55 @@ private void InitializeComponent() this.TbDeviceName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.TbDeviceName.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.TbDeviceName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.TbDeviceName.Location = new System.Drawing.Point(183, 196); + this.TbDeviceName.Location = new System.Drawing.Point(180, 287); this.TbDeviceName.Name = "TbDeviceName"; - this.TbDeviceName.Size = new System.Drawing.Size(372, 25); + this.TbDeviceName.Size = new System.Drawing.Size(358, 25); this.TbDeviceName.TabIndex = 50; // // LblDeviceName // this.LblDeviceName.AutoSize = true; this.LblDeviceName.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblDeviceName.Location = new System.Drawing.Point(180, 174); + this.LblDeviceName.Location = new System.Drawing.Point(177, 265); this.LblDeviceName.Name = "LblDeviceName"; this.LblDeviceName.Size = new System.Drawing.Size(85, 19); this.LblDeviceName.TabIndex = 52; this.LblDeviceName.Text = Languages.OnboardingWelcome_LblDeviceName; // - // Welcome + // CbLanguage + // + this.CbLanguage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); + this.CbLanguage.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.CbLanguage.DropDownHeight = 300; + this.CbLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CbLanguage.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.CbLanguage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); + this.CbLanguage.FormattingEnabled = true; + this.CbLanguage.IntegralHeight = false; + this.CbLanguage.Location = new System.Drawing.Point(180, 177); + this.CbLanguage.Name = "CbLanguage"; + this.CbLanguage.Size = new System.Drawing.Size(358, 26); + this.CbLanguage.Sorted = true; + this.CbLanguage.TabIndex = 68; + this.CbLanguage.SelectedIndexChanged += new System.EventHandler(this.CbLanguage_SelectedIndexChanged); + // + // LblInterfaceLangauge + // + this.LblInterfaceLangauge.AutoSize = true; + this.LblInterfaceLangauge.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.LblInterfaceLangauge.Location = new System.Drawing.Point(177, 155); + this.LblInterfaceLangauge.Name = "LblInterfaceLangauge"; + this.LblInterfaceLangauge.Size = new System.Drawing.Size(121, 19); + this.LblInterfaceLangauge.TabIndex = 67; + this.LblInterfaceLangauge.Text = Languages.OnboardingWelcome_LblInterfaceLangauge; + // + // OnboardingWelcome // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(48))))); + this.Controls.Add(this.CbLanguage); + this.Controls.Add(this.LblInterfaceLangauge); this.Controls.Add(this.LblDeviceName); this.Controls.Add(this.LblInfo2); this.Controls.Add(this.TbDeviceName); @@ -102,7 +133,7 @@ private void InitializeComponent() this.Controls.Add(this.LblInfo1); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Welcome"; + this.Name = "OnboardingWelcome"; this.Size = new System.Drawing.Size(803, 457); this.Load += new System.EventHandler(this.OnboardingWelcome_Load); ((System.ComponentModel.ISupportInitialize)(this.PbHassAgentLogo)).EndInit(); @@ -117,5 +148,7 @@ private void InitializeComponent() private System.Windows.Forms.Label LblInfo2; private System.Windows.Forms.TextBox TbDeviceName; private System.Windows.Forms.Label LblDeviceName; + internal ComboBox CbLanguage; + private Label LblInterfaceLangauge; } } diff --git a/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.cs b/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.cs index a6f5e48..8d1278b 100644 --- a/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.cs +++ b/src/HASS.Agent/Controls/Onboarding/Onboarding-1-Welcome.cs @@ -1,22 +1,84 @@ -namespace HASS.Agent.Controls.Onboarding +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using HASS.Agent.Functions; +using HASS.Agent.Resources.Localization; +using Microsoft.VisualBasic.Logging; + +namespace HASS.Agent.Controls.Onboarding { public partial class OnboardingWelcome : UserControl { + private ComponentResourceManager _resourceManager; + private readonly string _previousCulture = Variables.CurrentUICulture.Name; + public OnboardingWelcome() { - InitializeComponent(); + InitializeComponent(); + + BindComboBoxTheme(); + + _resourceManager = new ComponentResourceManager(GetType()); } + private void BindComboBoxTheme() => CbLanguage.DrawItem += ComboBoxTheme.DrawItem; + private void OnboardingWelcome_Load(object sender, EventArgs e) { + // load all languages + foreach (var lang in Variables.SupportedUILanguages) CbLanguage.Items.Add(lang.DisplayName); + + // select the current one + CbLanguage.SelectedItem = Variables.CurrentUICulture.DisplayName; + + // set devicename TbDeviceName.Text = Variables.AppSettings.DeviceName; + + // focus on devicename ActiveControl = TbDeviceName; } - internal bool Store() + internal bool Store(out bool languageChanged) { + languageChanged = false; + + // store devicename Variables.AppSettings.DeviceName = TbDeviceName.Text; + + // store ui language + var uiLanguage = Variables.SupportedUILanguages.Find(x => x.DisplayName == CbLanguage.Text); + Variables.AppSettings.InterfaceLanguage = uiLanguage?.Name ?? "en"; + + if (uiLanguage?.Name != _previousCulture) + { + // ui language changed + languageChanged = true; + } + + // done return true; } + + private void CbLanguage_SelectedIndexChanged(object sender, EventArgs e) + { + var uiLanguage = Variables.SupportedUILanguages.Find(x => x.DisplayName == CbLanguage.Text); + if (uiLanguage == null) return; + + if (uiLanguage.Name == _previousCulture) return; + + // set the new language + LocalizationManager.SetNewUILanguage(uiLanguage.Name); + + // language changed + ReloadUi(); + } + + private void ReloadUi() + { + LblInfo1.Text = Languages.OnboardingWelcome_LblInfo1; + LblInfo2.Text = Languages.OnboardingWelcome_LblInfo2; + LblDeviceName.Text = Languages.OnboardingWelcome_LblDeviceName; + LblInterfaceLangauge.Text = Languages.OnboardingWelcome_LblInterfaceLangauge; + } } } diff --git a/src/HASS.Agent/Controls/Onboarding/Onboarding-2-Startup.Designer.cs b/src/HASS.Agent/Controls/Onboarding/Onboarding-2-Startup.Designer.cs index 0cbdb3e..5ee09f4 100644 --- a/src/HASS.Agent/Controls/Onboarding/Onboarding-2-Startup.Designer.cs +++ b/src/HASS.Agent/Controls/Onboarding/Onboarding-2-Startup.Designer.cs @@ -66,7 +66,7 @@ private void InitializeComponent() this.BtnSetLaunchOnLogin.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnSetLaunchOnLogin.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnSetLaunchOnLogin.TabIndex = 0; - this.BtnSetLaunchOnLogin.Text = Languages.OnboardingStartup_BtnSetLaunchOnLogin; + this.BtnSetLaunchOnLogin.Text = global::HASS.Agent.Resources.Localization.Languages.OnboardingStartup_BtnSetLaunchOnLogin; this.BtnSetLaunchOnLogin.UseVisualStyleBackColor = false; this.BtnSetLaunchOnLogin.Click += new System.EventHandler(this.BtnSetLaunchOnLogin_Click); // @@ -89,7 +89,7 @@ private void InitializeComponent() this.LblCreateInfo.TabIndex = 6; this.LblCreateInfo.Text = Languages.OnboardingStartup_LblCreateInfo; // - // Startup + // OnboardingStartup // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -100,7 +100,7 @@ private void InitializeComponent() this.Controls.Add(this.PbHassAgentLogo); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "Startup"; + this.Name = "OnboardingStartup"; this.Size = new System.Drawing.Size(803, 457); this.Load += new System.EventHandler(this.OnboardingStartup_Load); ((System.ComponentModel.ISupportInitialize)(this.PbHassAgentLogo)).EndInit(); diff --git a/src/HASS.Agent/Controls/Onboarding/Onboarding-6-MQTT.Designer.cs b/src/HASS.Agent/Controls/Onboarding/Onboarding-6-MQTT.Designer.cs index 22f23a7..86c21bb 100644 --- a/src/HASS.Agent/Controls/Onboarding/Onboarding-6-MQTT.Designer.cs +++ b/src/HASS.Agent/Controls/Onboarding/Onboarding-6-MQTT.Designer.cs @@ -209,7 +209,7 @@ private void InitializeComponent() this.NumMqttPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.NumMqttPort.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.NumMqttPort.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.NumMqttPort.Location = new System.Drawing.Point(223, 206); + this.NumMqttPort.Location = new System.Drawing.Point(260, 206); this.NumMqttPort.Maximum = new decimal(new int[] { 65535, 0, @@ -240,7 +240,7 @@ private void InitializeComponent() this.PbShow.TabStop = false; this.PbShow.Click += new System.EventHandler(this.PbShow_Click); // - // MQTT + // OnboardingMqtt // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -263,7 +263,7 @@ private void InitializeComponent() this.Controls.Add(this.PbHassAgentLogo); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "MQTT"; + this.Name = "OnboardingMqtt"; this.Size = new System.Drawing.Size(803, 457); this.Load += new System.EventHandler(this.OnboardingMqtt_Load); ((System.ComponentModel.ISupportInitialize)(this.PbHassAgentLogo)).EndInit(); diff --git a/src/HASS.Agent/Controls/Service/ServiceCommands.Designer.cs b/src/HASS.Agent/Controls/Service/ServiceCommands.Designer.cs index df051fc..7f99d5f 100644 --- a/src/HASS.Agent/Controls/Service/ServiceCommands.Designer.cs +++ b/src/HASS.Agent/Controls/Service/ServiceCommands.Designer.cs @@ -61,7 +61,7 @@ private void InitializeComponent() this.LblLowIntegrity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.LblLowIntegrity.AutoSize = true; this.LblLowIntegrity.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblLowIntegrity.Location = new System.Drawing.Point(813, 499); + this.LblLowIntegrity.Location = new System.Drawing.Point(726, 499); this.LblLowIntegrity.Name = "LblLowIntegrity"; this.LblLowIntegrity.Size = new System.Drawing.Size(73, 15); this.LblLowIntegrity.TabIndex = 51; @@ -71,7 +71,7 @@ private void InitializeComponent() // this.PbLowIntegrity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.PbLowIntegrity.Image = global::HASS.Agent.Properties.Resources.shield_16; - this.PbLowIntegrity.Location = new System.Drawing.Point(791, 498); + this.PbLowIntegrity.Location = new System.Drawing.Point(704, 498); this.PbLowIntegrity.Name = "PbLowIntegrity"; this.PbLowIntegrity.Size = new System.Drawing.Size(16, 16); this.PbLowIntegrity.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -111,12 +111,12 @@ private void InitializeComponent() // // ClmName // - this.ClmName.Text = Languages.ServiceCommands_ClmName; + this.ClmName.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceCommands_ClmName; this.ClmName.Width = 400; // // ClmType // - this.ClmType.Text = Languages.ServiceCommands_ClmType; + this.ClmType.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceCommands_ClmType; this.ClmType.Width = 350; // // ClmLowIntegrity @@ -146,7 +146,7 @@ private void InitializeComponent() this.BtnRemove.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnRemove.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnRemove.TabIndex = 48; - this.BtnRemove.Text = Languages.ServiceCommands_BtnRemove; + this.BtnRemove.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceCommands_BtnRemove; this.BtnRemove.UseVisualStyleBackColor = false; this.BtnRemove.Click += new System.EventHandler(this.BtnRemove_Click); // @@ -168,7 +168,7 @@ private void InitializeComponent() this.BtnModify.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnModify.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnModify.TabIndex = 47; - this.BtnModify.Text = Languages.ServiceCommands_BtnModify; + this.BtnModify.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceCommands_BtnModify; this.BtnModify.UseVisualStyleBackColor = false; this.BtnModify.Click += new System.EventHandler(this.BtnModify_Click); // @@ -190,7 +190,7 @@ private void InitializeComponent() this.BtnAdd.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnAdd.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnAdd.TabIndex = 46; - this.BtnAdd.Text = Languages.ServiceCommands_BtnAdd; + this.BtnAdd.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceCommands_BtnAdd; this.BtnAdd.UseVisualStyleBackColor = false; this.BtnAdd.Click += new System.EventHandler(this.BtnAdd_Click); // @@ -213,20 +213,20 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 52; - this.BtnStore.Text = Languages.ServiceCommands_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceCommands_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // // LblStored // - this.LblStored.AutoSize = true; this.LblStored.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblStored.ForeColor = System.Drawing.Color.LimeGreen; - this.LblStored.Location = new System.Drawing.Point(259, 523); + this.LblStored.Location = new System.Drawing.Point(206, 523); this.LblStored.Name = "LblStored"; - this.LblStored.Size = new System.Drawing.Size(185, 30); + this.LblStored.Size = new System.Drawing.Size(289, 35); this.LblStored.TabIndex = 99; this.LblStored.Text = Languages.ServiceCommands_LblStored; + this.LblStored.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.LblStored.Visible = false; // // ServiceCommands diff --git a/src/HASS.Agent/Controls/Service/ServiceCommands.resx b/src/HASS.Agent/Controls/Service/ServiceCommands.resx index dd15822..7b4e29e 100644 --- a/src/HASS.Agent/Controls/Service/ServiceCommands.resx +++ b/src/HASS.Agent/Controls/Service/ServiceCommands.resx @@ -65,7 +65,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAGgQAAAJNU0Z0AUkBTAMBAQAB - CAEAAQgBAAEQAQABEAEABP8BGQEACP8BQgFNATYHAAE2AwABKAMAAUADAAEQAwABAQEAARgGAAEMEgAB + GAEAARgBAAEQAQABEAEABP8BGQEACP8BQgFNATYHAAE2AwABKAMAAUADAAEQAwABAQEAARgGAAEMEgAB MAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0B MAItkAABMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATAC LQEwAi0BMAItkAABMAItATACLQEwAi0BMAItATACLQEwAi0BXAJZAckCyAHOAs0BZQJjATACLQEwAi0B diff --git a/src/HASS.Agent/Controls/Service/ServiceGeneral.Designer.cs b/src/HASS.Agent/Controls/Service/ServiceGeneral.Designer.cs index b0e7931..5aeb772 100644 --- a/src/HASS.Agent/Controls/Service/ServiceGeneral.Designer.cs +++ b/src/HASS.Agent/Controls/Service/ServiceGeneral.Designer.cs @@ -68,19 +68,17 @@ private void InitializeComponent() this.LblInfo1.Name = "LblInfo1"; this.LblInfo1.Size = new System.Drawing.Size(717, 19); this.LblInfo1.TabIndex = 57; - this.LblInfo1.Text = "This page contains general configuration items. For MQTT settings, sensors and co" + - "mmands, browse the tabs on top."; - this.LblInfo1.Visible = false; + this.LblInfo1.Text = Languages.ServiceGeneral_LblInfo1; // // LblAuthId // - this.LblAuthId.AutoSize = true; this.LblAuthId.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblAuthId.Location = new System.Drawing.Point(194, 181); + this.LblAuthId.Location = new System.Drawing.Point(16, 181); this.LblAuthId.Name = "LblAuthId"; - this.LblAuthId.Size = new System.Drawing.Size(52, 19); + this.LblAuthId.Size = new System.Drawing.Size(230, 19); this.LblAuthId.TabIndex = 61; - this.LblAuthId.Text = "auth id"; + this.LblAuthId.Text = Languages.ServiceGeneral_LblAuthId; + this.LblAuthId.TextAlign = System.Drawing.ContentAlignment.TopRight; // // TbAuthId // @@ -107,14 +105,14 @@ private void InitializeComponent() // // LblDeviceName // - this.LblDeviceName.AutoSize = true; this.LblDeviceName.Cursor = System.Windows.Forms.Cursors.Help; this.LblDeviceName.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblDeviceName.Location = new System.Drawing.Point(162, 250); + this.LblDeviceName.Location = new System.Drawing.Point(16, 250); this.LblDeviceName.Name = "LblDeviceName"; - this.LblDeviceName.Size = new System.Drawing.Size(85, 19); + this.LblDeviceName.Size = new System.Drawing.Size(231, 19); this.LblDeviceName.TabIndex = 64; - this.LblDeviceName.Text = "device name"; + this.LblDeviceName.Text = Languages.ServiceGeneral_LblDeviceName; + this.LblDeviceName.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblTip1 // @@ -124,7 +122,7 @@ private void InitializeComponent() this.LblTip1.Name = "LblTip1"; this.LblTip1.Size = new System.Drawing.Size(143, 15); this.LblTip1.TabIndex = 75; - this.LblTip1.Text = "tip: doubleclick to browse"; + this.LblTip1.Text = Languages.ServiceGeneral_LblTip1; // // TbExternalExecutorBinary // @@ -140,13 +138,13 @@ private void InitializeComponent() // // LblCustomExecBinary // - this.LblCustomExecBinary.AutoSize = true; this.LblCustomExecBinary.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblCustomExecBinary.Location = new System.Drawing.Point(95, 443); + this.LblCustomExecBinary.Location = new System.Drawing.Point(16, 443); this.LblCustomExecBinary.Name = "LblCustomExecBinary"; - this.LblCustomExecBinary.Size = new System.Drawing.Size(152, 19); + this.LblCustomExecBinary.Size = new System.Drawing.Size(231, 19); this.LblCustomExecBinary.TabIndex = 74; - this.LblCustomExecBinary.Text = "custom executor binary"; + this.LblCustomExecBinary.Text = Languages.ServiceGeneral_LblCustomExecBinary; + this.LblCustomExecBinary.TextAlign = System.Drawing.ContentAlignment.TopRight; // // TbExternalExecutorName // @@ -161,13 +159,13 @@ private void InitializeComponent() // // LblCustomExecName // - this.LblCustomExecName.AutoSize = true; this.LblCustomExecName.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblCustomExecName.Location = new System.Drawing.Point(99, 488); + this.LblCustomExecName.Location = new System.Drawing.Point(16, 488); this.LblCustomExecName.Name = "LblCustomExecName"; - this.LblCustomExecName.Size = new System.Drawing.Size(148, 19); + this.LblCustomExecName.Size = new System.Drawing.Size(231, 19); this.LblCustomExecName.TabIndex = 71; - this.LblCustomExecName.Text = "custom executor name"; + this.LblCustomExecName.Text = Languages.ServiceGeneral_LblCustomExecName; + this.LblCustomExecName.TextAlign = System.Drawing.ContentAlignment.TopRight; // // NumDisconnectGrace // @@ -205,18 +203,18 @@ private void InitializeComponent() this.LblSeconds.Name = "LblSeconds"; this.LblSeconds.Size = new System.Drawing.Size(58, 19); this.LblSeconds.TabIndex = 77; - this.LblSeconds.Text = "seconds"; + this.LblSeconds.Text = Languages.ServiceGeneral_LblSeconds; // // LblDisconGrace // - this.LblDisconGrace.AutoSize = true; this.LblDisconGrace.Cursor = System.Windows.Forms.Cursors.Help; this.LblDisconGrace.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblDisconGrace.Location = new System.Drawing.Point(78, 328); + this.LblDisconGrace.Location = new System.Drawing.Point(16, 328); this.LblDisconGrace.Name = "LblDisconGrace"; - this.LblDisconGrace.Size = new System.Drawing.Size(169, 19); + this.LblDisconGrace.Size = new System.Drawing.Size(231, 19); this.LblDisconGrace.TabIndex = 76; - this.LblDisconGrace.Text = "disconnected grace period"; + this.LblDisconGrace.Text = Languages.ServiceGeneral_LblDisconGrace; + this.LblDisconGrace.TextAlign = System.Drawing.ContentAlignment.TopRight; // // BtnStoreAuthId // @@ -304,13 +302,13 @@ private void InitializeComponent() // // LblVersionInfo // - this.LblVersionInfo.AutoSize = true; this.LblVersionInfo.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblVersionInfo.Location = new System.Drawing.Point(194, 100); + this.LblVersionInfo.Location = new System.Drawing.Point(16, 100); this.LblVersionInfo.Name = "LblVersionInfo"; - this.LblVersionInfo.Size = new System.Drawing.Size(53, 19); + this.LblVersionInfo.Size = new System.Drawing.Size(231, 19); this.LblVersionInfo.TabIndex = 94; - this.LblVersionInfo.Text = "version"; + this.LblVersionInfo.Text = Languages.ServiceGeneral_LblVersionInfo; + this.LblVersionInfo.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblVersion // @@ -325,13 +323,13 @@ private void InitializeComponent() // // LblTip2 // - this.LblTip2.AutoSize = true; this.LblTip2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblTip2.Location = new System.Drawing.Point(357, 205); + this.LblTip2.Location = new System.Drawing.Point(285, 205); this.LblTip2.Name = "LblTip2"; - this.LblTip2.Size = new System.Drawing.Size(196, 15); + this.LblTip2.Size = new System.Drawing.Size(268, 15); this.LblTip2.TabIndex = 96; this.LblTip2.Text = Languages.ServiceGeneral_LblTip2; + this.LblTip2.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblAuthStored // diff --git a/src/HASS.Agent/Controls/Service/ServiceMQTT.Designer.cs b/src/HASS.Agent/Controls/Service/ServiceMQTT.Designer.cs index 6a0a0d5..b4bc76b 100644 --- a/src/HASS.Agent/Controls/Service/ServiceMQTT.Designer.cs +++ b/src/HASS.Agent/Controls/Service/ServiceMQTT.Designer.cs @@ -73,7 +73,7 @@ private void InitializeComponent() this.NumMqttPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.NumMqttPort.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.NumMqttPort.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.NumMqttPort.Location = new System.Drawing.Point(114, 237); + this.NumMqttPort.Location = new System.Drawing.Point(138, 239); this.NumMqttPort.Maximum = new decimal(new int[] { 65535, 0, @@ -186,7 +186,7 @@ private void InitializeComponent() this.CbUseRetainFlag.Name = "CbUseRetainFlag"; this.CbUseRetainFlag.Size = new System.Drawing.Size(114, 23); this.CbUseRetainFlag.TabIndex = 86; - this.CbUseRetainFlag.Text = Languages.ServiceMqtt_CbUseRetainFlag; + this.CbUseRetainFlag.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceMqtt_CbUseRetainFlag; this.CbUseRetainFlag.UseVisualStyleBackColor = true; // // CbAllowUntrustedCertificates @@ -197,7 +197,7 @@ private void InitializeComponent() this.CbAllowUntrustedCertificates.Name = "CbAllowUntrustedCertificates"; this.CbAllowUntrustedCertificates.Size = new System.Drawing.Size(191, 23); this.CbAllowUntrustedCertificates.TabIndex = 85; - this.CbAllowUntrustedCertificates.Text = Languages.ServiceMqtt_CbAllowUntrustedCertificates; + this.CbAllowUntrustedCertificates.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceMqtt_CbAllowUntrustedCertificates; this.CbAllowUntrustedCertificates.UseVisualStyleBackColor = true; // // BtnMqttClearConfig @@ -217,7 +217,7 @@ private void InitializeComponent() this.BtnMqttClearConfig.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnMqttClearConfig.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnMqttClearConfig.TabIndex = 84; - this.BtnMqttClearConfig.Text = Languages.ServiceMqtt_BtnMqttClearConfig; + this.BtnMqttClearConfig.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceMqtt_BtnMqttClearConfig; this.BtnMqttClearConfig.UseVisualStyleBackColor = false; this.BtnMqttClearConfig.Click += new System.EventHandler(this.BtnMqttClearConfig_Click); // @@ -300,7 +300,7 @@ private void InitializeComponent() // this.CbMqttTls.AutoSize = true; this.CbMqttTls.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.CbMqttTls.Location = new System.Drawing.Point(220, 239); + this.CbMqttTls.Location = new System.Drawing.Point(290, 237); this.CbMqttTls.Name = "CbMqttTls"; this.CbMqttTls.Size = new System.Drawing.Size(49, 23); this.CbMqttTls.TabIndex = 73; @@ -366,7 +366,7 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 96; - this.BtnStore.Text = Languages.ServiceMqtt_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceMqtt_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // @@ -387,20 +387,20 @@ private void InitializeComponent() this.BtnCopy.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnCopy.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnCopy.TabIndex = 97; - this.BtnCopy.Text = Languages.ServiceMqtt_BtnCopy; + this.BtnCopy.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceMqtt_BtnCopy; this.BtnCopy.UseVisualStyleBackColor = false; this.BtnCopy.Click += new System.EventHandler(this.BtnCopy_Click); // // LblStored // - this.LblStored.AutoSize = true; this.LblStored.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblStored.ForeColor = System.Drawing.Color.LimeGreen; - this.LblStored.Location = new System.Drawing.Point(509, 529); + this.LblStored.Location = new System.Drawing.Point(275, 533); this.LblStored.Name = "LblStored"; - this.LblStored.Size = new System.Drawing.Size(141, 30); + this.LblStored.Size = new System.Drawing.Size(375, 30); this.LblStored.TabIndex = 98; this.LblStored.Text = Languages.ServiceMqtt_LblStored; + this.LblStored.TextAlign = System.Drawing.ContentAlignment.BottomRight; this.LblStored.Visible = false; // // PbShow @@ -436,7 +436,7 @@ private void InitializeComponent() this.LblStatus.TabIndex = 101; this.LblStatus.Text = Languages.ServiceMqtt_LblStatus; // - // MQTT + // ServiceMqtt // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; @@ -473,7 +473,7 @@ private void InitializeComponent() this.Controls.Add(this.LblBrokerIp); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "MQTT"; + this.Name = "ServiceMqtt"; this.Size = new System.Drawing.Size(903, 622); this.Load += new System.EventHandler(this.ServiceMqtt_Load); ((System.ComponentModel.ISupportInitialize)(this.NumMqttPort)).EndInit(); diff --git a/src/HASS.Agent/Controls/Service/ServiceMqtt.cs b/src/HASS.Agent/Controls/Service/ServiceMqtt.cs index 8b00b05..4b6831e 100644 --- a/src/HASS.Agent/Controls/Service/ServiceMqtt.cs +++ b/src/HASS.Agent/Controls/Service/ServiceMqtt.cs @@ -77,20 +77,29 @@ private void SetMqttStatus(MqttStatus status) { case MqttStatus.Connected: LblStatus.ForeColor = Color.LimeGreen; + LblStatus.Text = Languages.ServiceMqtt_SetMqttStatus_Connected; break; case MqttStatus.Connecting: LblStatus.ForeColor = Color.DarkOrange; + LblStatus.Text = Languages.ServiceMqtt_SetMqttStatus_Connecting; break; case MqttStatus.ConfigMissing: + LblStatus.ForeColor = Color.Red; + LblStatus.Text = Languages.ServiceMqtt_SetMqttStatus_ConfigError; + break; + case MqttStatus.Disconnected: + LblStatus.ForeColor = Color.Red; + LblStatus.Text = Languages.ServiceMqtt_SetMqttStatus_Disconnected; + break; + case MqttStatus.Error: LblStatus.ForeColor = Color.Red; + LblStatus.Text = Languages.ServiceMqtt_SetMqttStatus_Error; break; } - - LblStatus.Text = status.ToString().ToLower(); })); } diff --git a/src/HASS.Agent/Controls/Service/ServiceSensors.Designer.cs b/src/HASS.Agent/Controls/Service/ServiceSensors.Designer.cs index 9c4601e..c814457 100644 --- a/src/HASS.Agent/Controls/Service/ServiceSensors.Designer.cs +++ b/src/HASS.Agent/Controls/Service/ServiceSensors.Designer.cs @@ -89,12 +89,12 @@ private void InitializeComponent() // // ClmName // - this.ClmName.Text = Languages.ServiceSensors_ClmName; + this.ClmName.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceSensors_ClmName; this.ClmName.Width = 400; // // ClmType // - this.ClmType.Text = Languages.ServiceSensors_ClmType; + this.ClmType.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceSensors_ClmType; this.ClmType.Width = 350; // // ClmRefresh @@ -111,7 +111,7 @@ private void InitializeComponent() this.LblRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.LblRefresh.AutoSize = true; this.LblRefresh.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblRefresh.Location = new System.Drawing.Point(843, 499); + this.LblRefresh.Location = new System.Drawing.Point(726, 499); this.LblRefresh.Name = "LblRefresh"; this.LblRefresh.Size = new System.Drawing.Size(43, 15); this.LblRefresh.TabIndex = 47; @@ -121,7 +121,7 @@ private void InitializeComponent() // this.PbRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.PbRefresh.Image = global::HASS.Agent.Properties.Resources.refresh_16; - this.PbRefresh.Location = new System.Drawing.Point(821, 498); + this.PbRefresh.Location = new System.Drawing.Point(704, 498); this.PbRefresh.Name = "PbRefresh"; this.PbRefresh.Size = new System.Drawing.Size(16, 16); this.PbRefresh.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -146,7 +146,7 @@ private void InitializeComponent() this.BtnRemove.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnRemove.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnRemove.TabIndex = 44; - this.BtnRemove.Text = Languages.ServiceSensors_BtnRemove; + this.BtnRemove.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceSensors_BtnRemove; this.BtnRemove.UseVisualStyleBackColor = false; this.BtnRemove.Click += new System.EventHandler(this.BtnRemove_Click); // @@ -168,7 +168,7 @@ private void InitializeComponent() this.BtnAdd.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnAdd.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnAdd.TabIndex = 42; - this.BtnAdd.Text = Languages.ServiceSensors_BtnAdd; + this.BtnAdd.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceSensors_BtnAdd; this.BtnAdd.UseVisualStyleBackColor = false; this.BtnAdd.Click += new System.EventHandler(this.BtnAdd_Click); // @@ -190,7 +190,7 @@ private void InitializeComponent() this.BtnModify.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnModify.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnModify.TabIndex = 43; - this.BtnModify.Text = Languages.ServiceSensors_BtnModify; + this.BtnModify.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceSensors_BtnModify; this.BtnModify.UseVisualStyleBackColor = false; this.BtnModify.Click += new System.EventHandler(this.BtnModify_Click); // @@ -213,20 +213,20 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 48; - this.BtnStore.Text = Languages.ServiceSensors_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.ServiceSensors_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // // LblStored // - this.LblStored.AutoSize = true; this.LblStored.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblStored.ForeColor = System.Drawing.Color.LimeGreen; - this.LblStored.Location = new System.Drawing.Point(277, 523); + this.LblStored.Location = new System.Drawing.Point(206, 523); this.LblStored.Name = "LblStored"; - this.LblStored.Size = new System.Drawing.Size(152, 30); + this.LblStored.Size = new System.Drawing.Size(289, 35); this.LblStored.TabIndex = 100; this.LblStored.Text = Languages.ServiceSensors_LblStored; + this.LblStored.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.LblStored.Visible = false; // // ServiceSensors diff --git a/src/HASS.Agent/Controls/Service/ServiceSensors.resx b/src/HASS.Agent/Controls/Service/ServiceSensors.resx index 892617f..283928d 100644 --- a/src/HASS.Agent/Controls/Service/ServiceSensors.resx +++ b/src/HASS.Agent/Controls/Service/ServiceSensors.resx @@ -65,7 +65,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAARgQAAAJNU0Z0AUkBTAMBAQAB - CAEAAQgBAAEQAQABEAEABP8BGQEACP8BQgFNATYHAAE2AwABKAMAAUADAAEQAwABAQEAARgGAAEMEgAB + EAEAARABAAEQAQABEAEABP8BGQEACP8BQgFNATYHAAE2AwABKAMAAUADAAEQAwABAQEAARgGAAEMEgAB MAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0B MAItkAABMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATAC LQEwAi0BMAItkAABMAItATACLQEwAi0BMAItATACLQF6AngBsQKwAasDqQKoAbICsQGDAoEBMAItATAC diff --git a/src/HASS.Agent/Forms/About.Designer.cs b/src/HASS.Agent/Forms/About.Designer.cs index 5853a4b..c6b0f94 100644 --- a/src/HASS.Agent/Forms/About.Designer.cs +++ b/src/HASS.Agent/Forms/About.Designer.cs @@ -78,7 +78,7 @@ private void InitializeComponent() this.BtnClose.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnClose.Location = new System.Drawing.Point(0, 598); this.BtnClose.Name = "BtnClose"; - this.BtnClose.Size = new System.Drawing.Size(685, 37); + this.BtnClose.Size = new System.Drawing.Size(747, 37); this.BtnClose.Style.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.BtnClose.Style.FocusedBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.BtnClose.Style.FocusedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); @@ -87,7 +87,7 @@ private void InitializeComponent() this.BtnClose.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnClose.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnClose.TabIndex = 0; - this.BtnClose.Text = Languages.About_BtnClose; + this.BtnClose.Text = global::HASS.Agent.Resources.Localization.Languages.About_BtnClose; this.BtnClose.UseVisualStyleBackColor = false; this.BtnClose.Click += new System.EventHandler(this.BtnClose_Click); // @@ -109,7 +109,7 @@ private void InitializeComponent() this.LblInfo1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblInfo1.Location = new System.Drawing.Point(173, 70); this.LblInfo1.Name = "LblInfo1"; - this.LblInfo1.Size = new System.Drawing.Size(364, 19); + this.LblInfo1.Size = new System.Drawing.Size(360, 19); this.LblInfo1.TabIndex = 3; this.LblInfo1.Text = Languages.About_LblInfo1; // @@ -119,7 +119,7 @@ private void InitializeComponent() this.LblInfo3.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblInfo3.Location = new System.Drawing.Point(176, 134); this.LblInfo3.Name = "LblInfo3"; - this.LblInfo3.Size = new System.Drawing.Size(480, 38); + this.LblInfo3.Size = new System.Drawing.Size(536, 38); this.LblInfo3.TabIndex = 4; this.LblInfo3.Text = Languages.About_LblInfo3; // @@ -249,7 +249,7 @@ private void InitializeComponent() this.LblInfo4.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblInfo4.Location = new System.Drawing.Point(176, 377); this.LblInfo4.Name = "LblInfo4"; - this.LblInfo4.Size = new System.Drawing.Size(476, 38); + this.LblInfo4.Size = new System.Drawing.Size(530, 38); this.LblInfo4.TabIndex = 16; this.LblInfo4.Text = Languages.About_LblInfo4; // @@ -259,7 +259,7 @@ private void InitializeComponent() this.LblInfo5.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblInfo5.Location = new System.Drawing.Point(176, 431); this.LblInfo5.Name = "LblInfo5"; - this.LblInfo5.Size = new System.Drawing.Size(476, 38); + this.LblInfo5.Size = new System.Drawing.Size(524, 38); this.LblInfo5.TabIndex = 18; this.LblInfo5.Text = Languages.About_LblInfo5; // @@ -278,7 +278,7 @@ private void InitializeComponent() this.LblLab02Research.AutoSize = true; this.LblLab02Research.Cursor = System.Windows.Forms.Cursors.Hand; this.LblLab02Research.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblLab02Research.Location = new System.Drawing.Point(306, 105); + this.LblLab02Research.Location = new System.Drawing.Point(390, 105); this.LblLab02Research.Name = "LblLab02Research"; this.LblLab02Research.Size = new System.Drawing.Size(107, 19); this.LblLab02Research.TabIndex = 22; @@ -321,13 +321,13 @@ private void InitializeComponent() // // LblInfo6 // - this.LblInfo6.AutoSize = true; this.LblInfo6.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo6.Location = new System.Drawing.Point(173, 506); + this.LblInfo6.Location = new System.Drawing.Point(173, 483); this.LblInfo6.Name = "LblInfo6"; - this.LblInfo6.Size = new System.Drawing.Size(460, 19); + this.LblInfo6.Size = new System.Drawing.Size(562, 42); this.LblInfo6.TabIndex = 28; this.LblInfo6.Text = Languages.About_LblInfo6; + this.LblInfo6.TextAlign = System.Drawing.ContentAlignment.BottomLeft; // // PbBMAC // @@ -393,17 +393,17 @@ private void InitializeComponent() // this.LblOr.AutoSize = true; this.LblOr.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblOr.Location = new System.Drawing.Point(365, 550); + this.LblOr.Location = new System.Drawing.Point(420, 551); this.LblOr.Name = "LblOr"; this.LblOr.Size = new System.Drawing.Size(22, 19); this.LblOr.TabIndex = 32; - this.LblOr.Text = "or"; + this.LblOr.Text = Languages.About_LblOr; // // PbGithubSponsor // this.PbGithubSponsor.Cursor = System.Windows.Forms.Cursors.Hand; this.PbGithubSponsor.Image = global::HASS.Agent.Properties.Resources.githubsponsors; - this.PbGithubSponsor.Location = new System.Drawing.Point(421, 538); + this.PbGithubSponsor.Location = new System.Drawing.Point(523, 538); this.PbGithubSponsor.Name = "PbGithubSponsor"; this.PbGithubSponsor.Size = new System.Drawing.Size(212, 43); this.PbGithubSponsor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -443,7 +443,7 @@ private void InitializeComponent() this.CaptionBarColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.CaptionFont = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.CaptionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.ClientSize = new System.Drawing.Size(685, 635); + this.ClientSize = new System.Drawing.Size(747, 635); this.Controls.Add(this.LblByteSize); this.Controls.Add(this.LblGrpc); this.Controls.Add(this.PbGithubSponsor); diff --git a/src/HASS.Agent/Forms/ChildApplications/PortReservation.Designer.cs b/src/HASS.Agent/Forms/ChildApplications/PortReservation.Designer.cs index 3d6dc29..20945fb 100644 --- a/src/HASS.Agent/Forms/ChildApplications/PortReservation.Designer.cs +++ b/src/HASS.Agent/Forms/ChildApplications/PortReservation.Designer.cs @@ -42,13 +42,13 @@ private void InitializeComponent() // // LblInfo1 // - this.LblInfo1.AutoSize = true; this.LblInfo1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo1.Location = new System.Drawing.Point(166, 47); + this.LblInfo1.Location = new System.Drawing.Point(12, 20); this.LblInfo1.Name = "LblInfo1"; - this.LblInfo1.Size = new System.Drawing.Size(286, 19); + this.LblInfo1.Size = new System.Drawing.Size(595, 46); this.LblInfo1.TabIndex = 1; this.LblInfo1.Text = Languages.PortReservation_LblInfo1; + this.LblInfo1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // LblTask1 // diff --git a/src/HASS.Agent/Forms/ChildApplications/PortReservation.cs b/src/HASS.Agent/Forms/ChildApplications/PortReservation.cs index a3d9ef1..adb7198 100644 --- a/src/HASS.Agent/Forms/ChildApplications/PortReservation.cs +++ b/src/HASS.Agent/Forms/ChildApplications/PortReservation.cs @@ -28,10 +28,7 @@ private async void ProcessPostUpdate() // give the ui time to load await Task.Delay(TimeSpan.FromSeconds(2)); - - // make sure settings are loaded - await SettingsManager.LoadAsync(false, false); - + // execute port reservation var portDone = await ProcessPortReservationAsync(); PbStep1PortBinding.Image = portDone ? Properties.Resources.done_32 : Properties.Resources.failed_32; diff --git a/src/HASS.Agent/Forms/ChildApplications/PostUpdate.Designer.cs b/src/HASS.Agent/Forms/ChildApplications/PostUpdate.Designer.cs index 0f0f311..82391f0 100644 --- a/src/HASS.Agent/Forms/ChildApplications/PostUpdate.Designer.cs +++ b/src/HASS.Agent/Forms/ChildApplications/PostUpdate.Designer.cs @@ -42,13 +42,13 @@ private void InitializeComponent() // // LblInfo1 // - this.LblInfo1.AutoSize = true; this.LblInfo1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo1.Location = new System.Drawing.Point(112, 47); + this.LblInfo1.Location = new System.Drawing.Point(12, 9); this.LblInfo1.Name = "LblInfo1"; - this.LblInfo1.Size = new System.Drawing.Size(395, 19); + this.LblInfo1.Size = new System.Drawing.Size(604, 57); this.LblInfo1.TabIndex = 1; this.LblInfo1.Text = Languages.PostUpdate_LblInfo1; + this.LblInfo1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // PbStep1InstallSatelliteService // diff --git a/src/HASS.Agent/Forms/ChildApplications/PostUpdate.cs b/src/HASS.Agent/Forms/ChildApplications/PostUpdate.cs index 49f748a..16fffb9 100644 --- a/src/HASS.Agent/Forms/ChildApplications/PostUpdate.cs +++ b/src/HASS.Agent/Forms/ChildApplications/PostUpdate.cs @@ -30,10 +30,7 @@ private async void ProcessPostUpdate() // give the ui time to load await Task.Delay(TimeSpan.FromSeconds(2)); - - // make sure settings are loaded - await SettingsManager.LoadAsync(false, false); - + // install/configure satellite service var serviceDone = await ConfigureSatelliteServiceAsync(); PbStep1InstallSatelliteService.Image = serviceDone ? Properties.Resources.done_32 : Properties.Resources.failed_32; diff --git a/src/HASS.Agent/Forms/ChildApplications/Restart.Designer.cs b/src/HASS.Agent/Forms/ChildApplications/Restart.Designer.cs index 6692eb9..596702d 100644 --- a/src/HASS.Agent/Forms/ChildApplications/Restart.Designer.cs +++ b/src/HASS.Agent/Forms/ChildApplications/Restart.Designer.cs @@ -42,13 +42,13 @@ private void InitializeComponent() // // LblInfo1 // - this.LblInfo1.AutoSize = true; this.LblInfo1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo1.Location = new System.Drawing.Point(170, 47); + this.LblInfo1.Location = new System.Drawing.Point(3, 9); this.LblInfo1.Name = "LblInfo1"; - this.LblInfo1.Size = new System.Drawing.Size(279, 19); + this.LblInfo1.Size = new System.Drawing.Size(612, 57); this.LblInfo1.TabIndex = 1; this.LblInfo1.Text = Languages.Restart_LblInfo1; + this.LblInfo1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // PbStep1WaitForInstances // diff --git a/src/HASS.Agent/Forms/ChildApplications/Restart.cs b/src/HASS.Agent/Forms/ChildApplications/Restart.cs index a2b87ae..fdea93d 100644 --- a/src/HASS.Agent/Forms/ChildApplications/Restart.cs +++ b/src/HASS.Agent/Forms/ChildApplications/Restart.cs @@ -10,7 +10,7 @@ namespace HASS.Agent.Forms.ChildApplications { public partial class Restart : MetroForm { - private const int MaxWaitSeconds = 20; + private const int MAX_WAIT_SECONDS = 20; public Restart() { @@ -35,7 +35,7 @@ private async void ProcessRestart() if (!closed) { PbStep1WaitForInstances.Image = Properties.Resources.failed_32; - MessageBoxAdv.Show(string.Format(Languages.Restart_ProcessRestart_MessageBox1, MaxWaitSeconds), Variables.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBoxAdv.Show(string.Format(Languages.Restart_ProcessRestart_MessageBox1, MAX_WAIT_SECONDS), Variables.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); // close up _ = HelperFunctions.ShutdownAsync(); @@ -68,7 +68,7 @@ private static async Task GetAllInstancesClosedAsync() { var sw = Stopwatch.StartNew(); - while (sw.Elapsed.TotalSeconds < MaxWaitSeconds) + while (sw.Elapsed.TotalSeconds < MAX_WAIT_SECONDS) { var stillActive = await Task.Run(() => HelperFunctions.IsProcessActiveUnderCurrentUser(Variables.ApplicationExecutable)); if (!stillActive) return true; diff --git a/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.Designer.cs b/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.Designer.cs index f03679d..86daeb1 100644 --- a/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.Designer.cs +++ b/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.Designer.cs @@ -42,13 +42,13 @@ private void InitializeComponent() // // LblInfo1 // - this.LblInfo1.AutoSize = true; this.LblInfo1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo1.Location = new System.Drawing.Point(150, 47); + this.LblInfo1.Location = new System.Drawing.Point(3, 9); this.LblInfo1.Name = "LblInfo1"; - this.LblInfo1.Size = new System.Drawing.Size(319, 19); + this.LblInfo1.Size = new System.Drawing.Size(615, 57); this.LblInfo1.TabIndex = 1; this.LblInfo1.Text = Languages.ServiceReinstall_LblInfo1; + this.LblInfo1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // PbStep1Remove // diff --git a/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.cs b/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.cs index 4b4213c..428b2a6 100644 --- a/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.cs +++ b/src/HASS.Agent/Forms/ChildApplications/ServiceReinstall.cs @@ -30,10 +30,7 @@ private async void ProcessReinstall() // give the ui time to load await Task.Delay(TimeSpan.FromSeconds(2)); - - // make sure settings are loaded - await SettingsManager.LoadAsync(false, false); - + // we need additional service local paths for the service var ioOk = await Task.Run(ServiceManager.SetSatelliteServiceLocalStorage); if (!ioOk) Log.Warning("[SERVICEREINSTALL] Locating service local storage failed, installation may as well"); diff --git a/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.Designer.cs b/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.Designer.cs index e262cba..657786a 100644 --- a/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.Designer.cs +++ b/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.Designer.cs @@ -39,13 +39,13 @@ private void InitializeComponent() // // LblInfo1 // - this.LblInfo1.AutoSize = true; this.LblInfo1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblInfo1.Location = new System.Drawing.Point(150, 47); + this.LblInfo1.Location = new System.Drawing.Point(2, 9); this.LblInfo1.Name = "LblInfo1"; - this.LblInfo1.Size = new System.Drawing.Size(322, 19); + this.LblInfo1.Size = new System.Drawing.Size(615, 57); this.LblInfo1.TabIndex = 1; this.LblInfo1.Text = Languages.ServiceSetState_LblInfo1; + this.LblInfo1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // PbStep1Configure // diff --git a/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.cs b/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.cs index e4e5cd3..f642c7b 100644 --- a/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.cs +++ b/src/HASS.Agent/Forms/ChildApplications/ServiceSetState.cs @@ -48,10 +48,7 @@ private async void ProcessState() // give the ui time to load await Task.Delay(TimeSpan.FromSeconds(2)); - - // make sure settings are loaded - await SettingsManager.LoadAsync(false, false); - + // set desired state var stateDone = false; switch (_desiredState) diff --git a/src/HASS.Agent/Forms/Commands/CommandMqttTopic.cs b/src/HASS.Agent/Forms/Commands/CommandMqttTopic.cs index a695ec1..5f4e56a 100644 --- a/src/HASS.Agent/Forms/Commands/CommandMqttTopic.cs +++ b/src/HASS.Agent/Forms/Commands/CommandMqttTopic.cs @@ -43,7 +43,15 @@ private void MqttTopic_KeyUp(object sender, KeyEventArgs e) private void BtnCopyClipboard_Click(object sender, EventArgs e) { - Clipboard.SetText(TbMqttTopic.Text); + // setting clipboard needs to be done in STA mode + var thread = new Thread(() => Clipboard.SetText(TbMqttTopic.Text)); + thread.SetApartmentState(ApartmentState.STA); + thread.Start(); + + // wait for clipboard to finish + thread.Join(TimeSpan.FromSeconds(1)); + + // all done BtnCopyClipboard.Text = Languages.CommandMqttTopic_BtnCopyClipboard_Copied; BtnCopyClipboard.Enabled = false; } diff --git a/src/HASS.Agent/Forms/Commands/CommandsConfig.Designer.cs b/src/HASS.Agent/Forms/Commands/CommandsConfig.Designer.cs index c94e458..e9d34d5 100644 --- a/src/HASS.Agent/Forms/Commands/CommandsConfig.Designer.cs +++ b/src/HASS.Agent/Forms/Commands/CommandsConfig.Designer.cs @@ -71,7 +71,7 @@ private void InitializeComponent() this.BtnRemove.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnRemove.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnRemove.TabIndex = 10; - this.BtnRemove.Text = Languages.CommandsConfig_BtnRemove; + this.BtnRemove.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsConfig_BtnRemove; this.BtnRemove.UseVisualStyleBackColor = false; this.BtnRemove.Click += new System.EventHandler(this.BtnRemove_Click); // @@ -93,7 +93,7 @@ private void InitializeComponent() this.BtnModify.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnModify.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnModify.TabIndex = 9; - this.BtnModify.Text = Languages.CommandsConfig_BtnModify; + this.BtnModify.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsConfig_BtnModify; this.BtnModify.UseVisualStyleBackColor = false; this.BtnModify.Click += new System.EventHandler(this.BtnModify_Click); // @@ -115,7 +115,7 @@ private void InitializeComponent() this.BtnAdd.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnAdd.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnAdd.TabIndex = 8; - this.BtnAdd.Text = Languages.CommandsConfig_BtnAdd; + this.BtnAdd.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsConfig_BtnAdd; this.BtnAdd.UseVisualStyleBackColor = false; this.BtnAdd.Click += new System.EventHandler(this.BtnAdd_Click); // @@ -138,7 +138,7 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 6; - this.BtnStore.Text = Languages.CommandsConfig_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsConfig_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // @@ -178,12 +178,12 @@ private void InitializeComponent() // // ClmName // - this.ClmName.Text = Languages.CommandsConfig_ClmName; + this.ClmName.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsConfig_ClmName; this.ClmName.Width = 300; // // ClmType // - this.ClmType.Text = Languages.CommandsConfig_ClmType; + this.ClmType.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsConfig_ClmType; this.ClmType.Width = 190; // // ClmLowIntegrity @@ -212,7 +212,7 @@ private void InitializeComponent() this.LblLowIntegrity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.LblLowIntegrity.AutoSize = true; this.LblLowIntegrity.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblLowIntegrity.Location = new System.Drawing.Point(487, 487); + this.LblLowIntegrity.Location = new System.Drawing.Point(412, 487); this.LblLowIntegrity.Name = "LblLowIntegrity"; this.LblLowIntegrity.Size = new System.Drawing.Size(73, 15); this.LblLowIntegrity.TabIndex = 39; @@ -222,7 +222,7 @@ private void InitializeComponent() // this.PbLowIntegrity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.PbLowIntegrity.Image = global::HASS.Agent.Properties.Resources.shield_16; - this.PbLowIntegrity.Location = new System.Drawing.Point(465, 486); + this.PbLowIntegrity.Location = new System.Drawing.Point(390, 486); this.PbLowIntegrity.Name = "PbLowIntegrity"; this.PbLowIntegrity.Size = new System.Drawing.Size(16, 16); this.PbLowIntegrity.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -234,18 +234,18 @@ private void InitializeComponent() this.LblActionInfo.AutoSize = true; this.LblActionInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.LblActionInfo.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblActionInfo.Location = new System.Drawing.Point(605, 487); + this.LblActionInfo.Location = new System.Drawing.Point(547, 487); this.LblActionInfo.Name = "LblActionInfo"; this.LblActionInfo.Size = new System.Drawing.Size(40, 15); this.LblActionInfo.TabIndex = 45; - this.LblActionInfo.Text = Languages.CommandsConfig_LblActionInfo; + this.LblActionInfo.Text = "action"; this.LblActionInfo.Click += new System.EventHandler(this.LblActionInfo_Click); // // PbActionInfo // this.PbActionInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.PbActionInfo.Image = global::HASS.Agent.Properties.Resources.action_16; - this.PbActionInfo.Location = new System.Drawing.Point(583, 486); + this.PbActionInfo.Location = new System.Drawing.Point(525, 486); this.PbActionInfo.Name = "PbActionInfo"; this.PbActionInfo.Size = new System.Drawing.Size(16, 16); this.PbActionInfo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; diff --git a/src/HASS.Agent/Forms/Commands/CommandsConfig.resx b/src/HASS.Agent/Forms/Commands/CommandsConfig.resx index 5f110e2..8c8db7e 100644 --- a/src/HASS.Agent/Forms/Commands/CommandsConfig.resx +++ b/src/HASS.Agent/Forms/Commands/CommandsConfig.resx @@ -65,7 +65,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAEggAAAJNU0Z0AUkBTAIBAQIB - AAHoAQAB6AEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABGAYAAQwS + AAHwAQAB8AEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABGAYAAQwS AAEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATAC LQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATAC LQEwAi0BMAItYAABMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0B diff --git a/src/HASS.Agent/Forms/Commands/CommandsMod.Designer.cs b/src/HASS.Agent/Forms/Commands/CommandsMod.Designer.cs index d258801..28c61cd 100644 --- a/src/HASS.Agent/Forms/Commands/CommandsMod.Designer.cs +++ b/src/HASS.Agent/Forms/Commands/CommandsMod.Designer.cs @@ -88,7 +88,7 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 3; - this.BtnStore.Text = Languages.CommandsMod_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsMod_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // @@ -180,20 +180,20 @@ private void InitializeComponent() this.CbRunAsLowIntegrity.Name = "CbRunAsLowIntegrity"; this.CbRunAsLowIntegrity.Size = new System.Drawing.Size(152, 23); this.CbRunAsLowIntegrity.TabIndex = 26; - this.CbRunAsLowIntegrity.Text = Languages.CommandsMod_CbRunAsLowIntegrity; + this.CbRunAsLowIntegrity.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsMod_CbRunAsLowIntegrity; this.CbRunAsLowIntegrity.UseVisualStyleBackColor = true; this.CbRunAsLowIntegrity.Visible = false; // // LblIntegrityInfo // - this.LblIntegrityInfo.AutoSize = true; this.LblIntegrityInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.LblIntegrityInfo.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblIntegrityInfo.Location = new System.Drawing.Point(739, 298); + this.LblIntegrityInfo.Location = new System.Drawing.Point(739, 296); this.LblIntegrityInfo.Name = "LblIntegrityInfo"; - this.LblIntegrityInfo.Size = new System.Drawing.Size(68, 15); + this.LblIntegrityInfo.Size = new System.Drawing.Size(155, 15); this.LblIntegrityInfo.TabIndex = 27; this.LblIntegrityInfo.Text = Languages.CommandsMod_LblIntegrityInfo; + this.LblIntegrityInfo.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.LblIntegrityInfo.Visible = false; this.LblIntegrityInfo.Click += new System.EventHandler(this.LblIntegrityInfo_Click); // @@ -247,7 +247,7 @@ private void InitializeComponent() // // ClmSensorName // - this.ClmSensorName.Text = Languages.CommandsMod_ClmSensorName; + this.ClmSensorName.Text = global::HASS.Agent.Resources.Localization.Languages.CommandsMod_ClmSensorName; this.ClmSensorName.Width = 300; // // ClmAgentCompatible diff --git a/src/HASS.Agent/Forms/Commands/CommandsMod.resx b/src/HASS.Agent/Forms/Commands/CommandsMod.resx index 365d7d3..1c3d0e4 100644 --- a/src/HASS.Agent/Forms/Commands/CommandsMod.resx +++ b/src/HASS.Agent/Forms/Commands/CommandsMod.resx @@ -65,7 +65,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA/g0AAAJNU0Z0AUkBTAIBAQQB - AAGYAQABmAEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAASADAAEBAQABGAYAARj/ + AAGgAQABoAEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAASADAAEBAQABGAYAARj/ AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wAeAAEwAi0BMAItATACLQEwAi0k8QEwAi0BMAItATACLQEwAi0B MAItATACLQEwAi0BMAItATACLQEwAi0BMAItATYCNAE5AjYBuwK6AZMCkgEwAi0BMAItATACLQEwAi0B OQI2AXsCeQGuAq0BPwI8ATACLQEwAi0BMwIwAaICoQFsAmoBMAItATACLQEwAi0BMAItATACLQEwAi0B diff --git a/src/HASS.Agent/Forms/Configuration.cs b/src/HASS.Agent/Forms/Configuration.cs index fd046bb..afbde30 100644 --- a/src/HASS.Agent/Forms/Configuration.cs +++ b/src/HASS.Agent/Forms/Configuration.cs @@ -123,7 +123,7 @@ private async void ProcessChanges() BtnClose.Enabled = false; BtnStore.Enabled = false; - BtnStore.Text = "busy, hold on .."; + BtnStore.Text = Languages.Configuration_BtnStore_Busy; // store settings StoreSettings(); @@ -210,6 +210,7 @@ private void LoadSettings() // general _general.TbDeviceName.Text = Variables.AppSettings.DeviceName; _general.NumDisconnectGrace.Value = Variables.AppSettings.DisconnectedGracePeriodSeconds; + // startup settings Task.Run(_startup.DetermineStartOnLoginStatus); @@ -278,6 +279,9 @@ private void StoreSettings() var deviceName = string.IsNullOrEmpty(_general.TbDeviceName.Text) ? HelperFunctions.GetSafeDeviceName() : _general.TbDeviceName.Text; Variables.AppSettings.DeviceName = deviceName; + var uiLanguage = Variables.SupportedUILanguages.Find(x => x.DisplayName == _general.CbLanguage.Text); + Variables.AppSettings.InterfaceLanguage = uiLanguage?.Name ?? "en"; + Variables.AppSettings.DisconnectedGracePeriodSeconds = (int)_general.NumDisconnectGrace.Value; // notifications diff --git a/src/HASS.Agent/Forms/Help.Designer.cs b/src/HASS.Agent/Forms/Help.Designer.cs index 32a43cb..b29d641 100644 --- a/src/HASS.Agent/Forms/Help.Designer.cs +++ b/src/HASS.Agent/Forms/Help.Designer.cs @@ -63,7 +63,7 @@ private void InitializeComponent() this.BtnClose.Dock = System.Windows.Forms.DockStyle.Bottom; this.BtnClose.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.BtnClose.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.BtnClose.Location = new System.Drawing.Point(0, 523); + this.BtnClose.Location = new System.Drawing.Point(0, 569); this.BtnClose.Name = "BtnClose"; this.BtnClose.Size = new System.Drawing.Size(626, 37); this.BtnClose.Style.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); @@ -93,7 +93,7 @@ private void InitializeComponent() this.LblAbout.AutoSize = true; this.LblAbout.Cursor = System.Windows.Forms.Cursors.Hand; this.LblAbout.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblAbout.Location = new System.Drawing.Point(0, 501); + this.LblAbout.Location = new System.Drawing.Point(0, 547); this.LblAbout.Name = "LblAbout"; this.LblAbout.Size = new System.Drawing.Size(47, 19); this.LblAbout.TabIndex = 22; @@ -115,7 +115,7 @@ private void InitializeComponent() this.LblHAForum.AutoSize = true; this.LblHAForum.Cursor = System.Windows.Forms.Cursors.Hand; this.LblHAForum.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblHAForum.Location = new System.Drawing.Point(258, 407); + this.LblHAForum.Location = new System.Drawing.Point(258, 473); this.LblHAForum.Name = "LblHAForum"; this.LblHAForum.Size = new System.Drawing.Size(146, 19); this.LblHAForum.TabIndex = 26; @@ -127,7 +127,7 @@ private void InitializeComponent() this.LblGitHub.AutoSize = true; this.LblGitHub.Cursor = System.Windows.Forms.Cursors.Hand; this.LblGitHub.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblGitHub.Location = new System.Drawing.Point(258, 143); + this.LblGitHub.Location = new System.Drawing.Point(258, 163); this.LblGitHub.Name = "LblGitHub"; this.LblGitHub.Size = new System.Drawing.Size(96, 19); this.LblGitHub.TabIndex = 28; @@ -139,7 +139,7 @@ private void InitializeComponent() this.LblDiscord.AutoSize = true; this.LblDiscord.Cursor = System.Windows.Forms.Cursors.Hand; this.LblDiscord.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblDiscord.Location = new System.Drawing.Point(258, 319); + this.LblDiscord.Location = new System.Drawing.Point(258, 369); this.LblDiscord.Name = "LblDiscord"; this.LblDiscord.Size = new System.Drawing.Size(55, 19); this.LblDiscord.TabIndex = 30; @@ -150,9 +150,9 @@ private void InitializeComponent() // this.LblHAInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.LblHAInfo.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblHAInfo.Location = new System.Drawing.Point(258, 437); + this.LblHAInfo.Location = new System.Drawing.Point(258, 503); this.LblHAInfo.Name = "LblHAInfo"; - this.LblHAInfo.Size = new System.Drawing.Size(292, 49); + this.LblHAInfo.Size = new System.Drawing.Size(356, 63); this.LblHAInfo.TabIndex = 31; this.LblHAInfo.Text = Languages.Help_LblHAInfo; this.LblHAInfo.Click += new System.EventHandler(this.LblHAInfo_Click); @@ -161,9 +161,9 @@ private void InitializeComponent() // this.LblGitHubInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.LblGitHubInfo.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblGitHubInfo.Location = new System.Drawing.Point(258, 173); + this.LblGitHubInfo.Location = new System.Drawing.Point(258, 193); this.LblGitHubInfo.Name = "LblGitHubInfo"; - this.LblGitHubInfo.Size = new System.Drawing.Size(292, 35); + this.LblGitHubInfo.Size = new System.Drawing.Size(356, 65); this.LblGitHubInfo.TabIndex = 32; this.LblGitHubInfo.Text = Languages.Help_LblGitHubInfo; this.LblGitHubInfo.Click += new System.EventHandler(this.LblGitHubInfo_Click); @@ -172,9 +172,9 @@ private void InitializeComponent() // this.LblDiscordInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.LblDiscordInfo.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblDiscordInfo.Location = new System.Drawing.Point(258, 349); + this.LblDiscordInfo.Location = new System.Drawing.Point(258, 399); this.LblDiscordInfo.Name = "LblDiscordInfo"; - this.LblDiscordInfo.Size = new System.Drawing.Size(309, 46); + this.LblDiscordInfo.Size = new System.Drawing.Size(356, 64); this.LblDiscordInfo.TabIndex = 33; this.LblDiscordInfo.Text = Languages.Help_LblDiscordInfo; this.LblDiscordInfo.Click += new System.EventHandler(this.LblDiscordInfo_Click); @@ -183,7 +183,7 @@ private void InitializeComponent() // this.PbDiscord.Cursor = System.Windows.Forms.Cursors.Hand; this.PbDiscord.Image = global::HASS.Agent.Properties.Resources.discord_avatar; - this.PbDiscord.Location = new System.Drawing.Point(171, 319); + this.PbDiscord.Location = new System.Drawing.Point(171, 369); this.PbDiscord.Name = "PbDiscord"; this.PbDiscord.Size = new System.Drawing.Size(65, 65); this.PbDiscord.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -195,7 +195,7 @@ private void InitializeComponent() // this.PbGitHub.Cursor = System.Windows.Forms.Cursors.Hand; this.PbGitHub.Image = global::HASS.Agent.Properties.Resources.github_avatar; - this.PbGitHub.Location = new System.Drawing.Point(171, 143); + this.PbGitHub.Location = new System.Drawing.Point(171, 163); this.PbGitHub.Name = "PbGitHub"; this.PbGitHub.Size = new System.Drawing.Size(65, 65); this.PbGitHub.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -207,7 +207,7 @@ private void InitializeComponent() // this.PbHAForum.Cursor = System.Windows.Forms.Cursors.Hand; this.PbHAForum.Image = global::HASS.Agent.Properties.Resources.hass_avatar; - this.PbHAForum.Location = new System.Drawing.Point(171, 407); + this.PbHAForum.Location = new System.Drawing.Point(171, 472); this.PbHAForum.Name = "PbHAForum"; this.PbHAForum.Size = new System.Drawing.Size(65, 65); this.PbHAForum.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -231,7 +231,7 @@ private void InitializeComponent() // this.PbWiki.Cursor = System.Windows.Forms.Cursors.Hand; this.PbWiki.Image = global::HASS.Agent.Properties.Resources.github_avatar; - this.PbWiki.Location = new System.Drawing.Point(171, 231); + this.PbWiki.Location = new System.Drawing.Point(171, 266); this.PbWiki.Name = "PbWiki"; this.PbWiki.Size = new System.Drawing.Size(65, 65); this.PbWiki.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -243,9 +243,9 @@ private void InitializeComponent() // this.LblWikiInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.LblWikiInfo.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblWikiInfo.Location = new System.Drawing.Point(258, 261); + this.LblWikiInfo.Location = new System.Drawing.Point(258, 296); this.LblWikiInfo.Name = "LblWikiInfo"; - this.LblWikiInfo.Size = new System.Drawing.Size(292, 35); + this.LblWikiInfo.Size = new System.Drawing.Size(356, 61); this.LblWikiInfo.TabIndex = 38; this.LblWikiInfo.Text = Languages.Help_LblWikiInfo; this.LblWikiInfo.Click += new System.EventHandler(this.LblWikiInfo_Click); @@ -255,11 +255,11 @@ private void InitializeComponent() this.LblWiki.AutoSize = true; this.LblWiki.Cursor = System.Windows.Forms.Cursors.Hand; this.LblWiki.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); - this.LblWiki.Location = new System.Drawing.Point(258, 231); + this.LblWiki.Location = new System.Drawing.Point(258, 266); this.LblWiki.Name = "LblWiki"; this.LblWiki.Size = new System.Drawing.Size(35, 19); this.LblWiki.TabIndex = 37; - this.LblWiki.Text = "Wiki"; + this.LblWiki.Text = Languages.Help_LblWiki; this.LblWiki.Click += new System.EventHandler(this.LblWiki_Click); // // Help @@ -270,7 +270,7 @@ private void InitializeComponent() this.CaptionBarColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.CaptionFont = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.CaptionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.ClientSize = new System.Drawing.Size(626, 560); + this.ClientSize = new System.Drawing.Size(626, 606); this.Controls.Add(this.LblWikiInfo); this.Controls.Add(this.LblWiki); this.Controls.Add(this.PbWiki); diff --git a/src/HASS.Agent/Forms/Main.Designer.cs b/src/HASS.Agent/Forms/Main.Designer.cs index 9c88f8f..6a8d9c9 100644 --- a/src/HASS.Agent/Forms/Main.Designer.cs +++ b/src/HASS.Agent/Forms/Main.Designer.cs @@ -118,7 +118,7 @@ private void InitializeComponent() this.TsShow.Image = global::HASS.Agent.Properties.Resources.logo_32; this.TsShow.Name = "TsShow"; this.TsShow.Size = new System.Drawing.Size(194, 26); - this.TsShow.Text = Languages.Main_TsShow; + this.TsShow.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsShow; this.TsShow.Click += new System.EventHandler(this.TsShow_Click); // // TsShowQuickActions @@ -126,7 +126,7 @@ private void InitializeComponent() this.TsShowQuickActions.Image = global::HASS.Agent.Properties.Resources.ti_remote_32; this.TsShowQuickActions.Name = "TsShowQuickActions"; this.TsShowQuickActions.Size = new System.Drawing.Size(194, 26); - this.TsShowQuickActions.Text = Languages.Main_TsShowQuickActions; + this.TsShowQuickActions.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsShowQuickActions; this.TsShowQuickActions.Click += new System.EventHandler(this.TsShowQuickActions_Click); // // toolStripSeparator2 @@ -139,7 +139,7 @@ private void InitializeComponent() this.TsConfig.Image = global::HASS.Agent.Properties.Resources.ti_gear_32; this.TsConfig.Name = "TsConfig"; this.TsConfig.Size = new System.Drawing.Size(194, 26); - this.TsConfig.Text = Languages.Main_TsConfig; + this.TsConfig.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsConfig; this.TsConfig.Click += new System.EventHandler(this.TsConfig_Click); // // TsQuickItemsConfig @@ -147,7 +147,7 @@ private void InitializeComponent() this.TsQuickItemsConfig.Image = global::HASS.Agent.Properties.Resources.ti_remote_32; this.TsQuickItemsConfig.Name = "TsQuickItemsConfig"; this.TsQuickItemsConfig.Size = new System.Drawing.Size(194, 26); - this.TsQuickItemsConfig.Text = Languages.Main_TsQuickItemsConfig; + this.TsQuickItemsConfig.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsQuickItemsConfig; this.TsQuickItemsConfig.Click += new System.EventHandler(this.TsQuickItemsConfig_Click); // // TsLocalSensors @@ -155,7 +155,7 @@ private void InitializeComponent() this.TsLocalSensors.Image = global::HASS.Agent.Properties.Resources.ti_radar_32; this.TsLocalSensors.Name = "TsLocalSensors"; this.TsLocalSensors.Size = new System.Drawing.Size(194, 26); - this.TsLocalSensors.Text = Languages.Main_TsLocalSensors; + this.TsLocalSensors.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsLocalSensors; this.TsLocalSensors.Click += new System.EventHandler(this.TsLocalSensors_Click); // // TsCommands @@ -163,7 +163,7 @@ private void InitializeComponent() this.TsCommands.Image = global::HASS.Agent.Properties.Resources.ti_workflow_32; this.TsCommands.Name = "TsCommands"; this.TsCommands.Size = new System.Drawing.Size(194, 26); - this.TsCommands.Text = Languages.Main_TsCommands; + this.TsCommands.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsCommands; this.TsCommands.Click += new System.EventHandler(this.TsCommands_Click); // // toolStripMenuItem1 @@ -176,7 +176,7 @@ private void InitializeComponent() this.TsCheckForUpdates.Image = global::HASS.Agent.Properties.Resources.ti_update_32; this.TsCheckForUpdates.Name = "TsCheckForUpdates"; this.TsCheckForUpdates.Size = new System.Drawing.Size(194, 26); - this.TsCheckForUpdates.Text = Languages.Main_CheckForUpdates; + this.TsCheckForUpdates.Text = global::HASS.Agent.Resources.Localization.Languages.Main_CheckForUpdates; this.TsCheckForUpdates.Click += new System.EventHandler(this.TsCheckForUpdates_Click); // // toolStripSeparator1 @@ -189,7 +189,7 @@ private void InitializeComponent() this.TsDonate.Image = global::HASS.Agent.Properties.Resources.bmac_logo_32; this.TsDonate.Name = "TsDonate"; this.TsDonate.Size = new System.Drawing.Size(194, 26); - this.TsDonate.Text = Languages.Main_TsDonate; + this.TsDonate.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsDonate; this.TsDonate.Click += new System.EventHandler(this.TsDonate_Click); // // TsHelp @@ -197,7 +197,7 @@ private void InitializeComponent() this.TsHelp.Image = global::HASS.Agent.Properties.Resources.question_32; this.TsHelp.Name = "TsHelp"; this.TsHelp.Size = new System.Drawing.Size(194, 26); - this.TsHelp.Text = Languages.Main_TsHelp; + this.TsHelp.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsHelp; this.TsHelp.Click += new System.EventHandler(this.TsHelp_Click); // // TsAbout @@ -205,7 +205,7 @@ private void InitializeComponent() this.TsAbout.Image = global::HASS.Agent.Properties.Resources.question_32; this.TsAbout.Name = "TsAbout"; this.TsAbout.Size = new System.Drawing.Size(194, 26); - this.TsAbout.Text = Languages.Main_TsAbout; + this.TsAbout.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsAbout; this.TsAbout.Click += new System.EventHandler(this.TsAbout_Click); // // toolStripSeparator3 @@ -218,7 +218,7 @@ private void InitializeComponent() this.TsExit.Image = global::HASS.Agent.Properties.Resources.ti_exit_32; this.TsExit.Name = "TsExit"; this.TsExit.Size = new System.Drawing.Size(194, 26); - this.TsExit.Text = Languages.Main_TsExit; + this.TsExit.Text = global::HASS.Agent.Resources.Localization.Languages.Main_TsExit; this.TsExit.Click += new System.EventHandler(this.TsExit_Click); // // BtnExit @@ -260,7 +260,7 @@ private void InitializeComponent() this.BtnHide.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnHide.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnHide.TabIndex = 0; - this.BtnHide.Text = Languages.Main_BtnHide; + this.BtnHide.Text = global::HASS.Agent.Resources.Localization.Languages.Main_BtnHide; this.BtnHide.UseVisualStyleBackColor = false; this.BtnHide.Click += new System.EventHandler(this.BtnHide_Click); // @@ -300,7 +300,7 @@ private void InitializeComponent() this.BtnServiceManager.Style.Image = global::HASS.Agent.Properties.Resources.service_48; this.BtnServiceManager.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnServiceManager.TabIndex = 6; - this.BtnServiceManager.Text = Languages.Main_BtnServiceManager; + this.BtnServiceManager.Text = global::HASS.Agent.Resources.Localization.Languages.Main_BtnServiceManager; this.BtnServiceManager.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; this.BtnServiceManager.TextMargin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.BtnServiceManager.UseVisualStyleBackColor = false; @@ -326,7 +326,7 @@ private void InitializeComponent() this.BtnAppSettings.Style.Image = global::HASS.Agent.Properties.Resources.gear_48; this.BtnAppSettings.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnAppSettings.TabIndex = 2; - this.BtnAppSettings.Text = Languages.Main_BtnAppSettings; + this.BtnAppSettings.Text = global::HASS.Agent.Resources.Localization.Languages.Main_BtnAppSettings; this.BtnAppSettings.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; this.BtnAppSettings.UseVisualStyleBackColor = false; this.BtnAppSettings.Click += new System.EventHandler(this.BtnAppSettings_Click); @@ -351,7 +351,7 @@ private void InitializeComponent() this.BtnActionsManager.Style.Image = global::HASS.Agent.Properties.Resources.remote_48; this.BtnActionsManager.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnActionsManager.TabIndex = 3; - this.BtnActionsManager.Text = Languages.Main_BtnActionsManager; + this.BtnActionsManager.Text = global::HASS.Agent.Resources.Localization.Languages.Main_BtnActionsManager; this.BtnActionsManager.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; this.BtnActionsManager.UseVisualStyleBackColor = false; this.BtnActionsManager.Click += new System.EventHandler(this.BtnActionsManager_Click); @@ -377,7 +377,7 @@ private void InitializeComponent() this.BtnCommandsManager.Style.Image = global::HASS.Agent.Properties.Resources.workflow_48; this.BtnCommandsManager.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnCommandsManager.TabIndex = 5; - this.BtnCommandsManager.Text = Languages.Main_BtnCommandsManager; + this.BtnCommandsManager.Text = global::HASS.Agent.Resources.Localization.Languages.Main_BtnCommandsManager; this.BtnCommandsManager.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.BtnCommandsManager.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; this.BtnCommandsManager.UseVisualStyleBackColor = false; @@ -404,7 +404,7 @@ private void InitializeComponent() this.BtnSensorsManager.Style.Image = global::HASS.Agent.Properties.Resources.radar_48; this.BtnSensorsManager.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnSensorsManager.TabIndex = 4; - this.BtnSensorsManager.Text = Languages.Main_BtnSensorsManager; + this.BtnSensorsManager.Text = global::HASS.Agent.Resources.Localization.Languages.Main_BtnSensorsManager; this.BtnSensorsManager.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.BtnSensorsManager.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; this.BtnSensorsManager.UseVisualStyleBackColor = false; @@ -446,12 +446,12 @@ private void InitializeComponent() // // LblService // - this.LblService.AutoSize = true; - this.LblService.Location = new System.Drawing.Point(55, 124); + this.LblService.Location = new System.Drawing.Point(6, 124); this.LblService.Name = "LblService"; - this.LblService.Size = new System.Drawing.Size(103, 19); + this.LblService.Size = new System.Drawing.Size(152, 19); this.LblService.TabIndex = 12; this.LblService.Text = Languages.Main_LblService; + this.LblService.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblStatusMqtt // @@ -464,12 +464,12 @@ private void InitializeComponent() // // LblMqtt // - this.LblMqtt.AutoSize = true; - this.LblMqtt.Location = new System.Drawing.Point(116, 165); + this.LblMqtt.Location = new System.Drawing.Point(6, 165); this.LblMqtt.Name = "LblMqtt"; - this.LblMqtt.Size = new System.Drawing.Size(42, 19); + this.LblMqtt.Size = new System.Drawing.Size(152, 19); this.LblMqtt.TabIndex = 10; - this.LblMqtt.Text = "mqtt:"; + this.LblMqtt.Text = Languages.Main_LblMqtt; + this.LblMqtt.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblStatusCommands // @@ -482,12 +482,12 @@ private void InitializeComponent() // // LblCommands // - this.LblCommands.AutoSize = true; - this.LblCommands.Location = new System.Drawing.Point(313, 124); + this.LblCommands.Location = new System.Drawing.Point(216, 124); this.LblCommands.Name = "LblCommands"; - this.LblCommands.Size = new System.Drawing.Size(79, 19); + this.LblCommands.Size = new System.Drawing.Size(176, 19); this.LblCommands.TabIndex = 8; this.LblCommands.Text = Languages.Main_LblCommands; + this.LblCommands.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblStatusSensors // @@ -527,39 +527,39 @@ private void InitializeComponent() // // LblSensors // - this.LblSensors.AutoSize = true; - this.LblSensors.Location = new System.Drawing.Point(334, 83); + this.LblSensors.Location = new System.Drawing.Point(216, 83); this.LblSensors.Name = "LblSensors"; - this.LblSensors.Size = new System.Drawing.Size(58, 19); + this.LblSensors.Size = new System.Drawing.Size(176, 19); this.LblSensors.TabIndex = 3; this.LblSensors.Text = Languages.Main_LblSensors; + this.LblSensors.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblQuickActions // - this.LblQuickActions.AutoSize = true; - this.LblQuickActions.Location = new System.Drawing.Point(301, 42); + this.LblQuickActions.Location = new System.Drawing.Point(216, 42); this.LblQuickActions.Name = "LblQuickActions"; - this.LblQuickActions.Size = new System.Drawing.Size(91, 19); + this.LblQuickActions.Size = new System.Drawing.Size(176, 19); this.LblQuickActions.TabIndex = 2; this.LblQuickActions.Text = Languages.Main_LblQuickActions; + this.LblQuickActions.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblHomeAssistantApi // - this.LblHomeAssistantApi.AutoSize = true; - this.LblHomeAssistantApi.Location = new System.Drawing.Point(32, 83); + this.LblHomeAssistantApi.Location = new System.Drawing.Point(6, 83); this.LblHomeAssistantApi.Name = "LblHomeAssistantApi"; - this.LblHomeAssistantApi.Size = new System.Drawing.Size(126, 19); + this.LblHomeAssistantApi.Size = new System.Drawing.Size(152, 19); this.LblHomeAssistantApi.TabIndex = 1; this.LblHomeAssistantApi.Text = Languages.Main_LblHomeAssistantApi; + this.LblHomeAssistantApi.TextAlign = System.Drawing.ContentAlignment.TopRight; // // LblNotificationApi // - this.LblNotificationApi.AutoSize = true; - this.LblNotificationApi.Location = new System.Drawing.Point(56, 42); + this.LblNotificationApi.Location = new System.Drawing.Point(6, 42); this.LblNotificationApi.Name = "LblNotificationApi"; - this.LblNotificationApi.Size = new System.Drawing.Size(102, 19); + this.LblNotificationApi.Size = new System.Drawing.Size(152, 19); this.LblNotificationApi.TabIndex = 0; this.LblNotificationApi.Text = Languages.Main_LblNotificationApi; + this.LblNotificationApi.TextAlign = System.Drawing.ContentAlignment.TopRight; // // BtnCheckForUpdate // @@ -578,7 +578,7 @@ private void InitializeComponent() this.BtnCheckForUpdate.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnCheckForUpdate.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnCheckForUpdate.TabIndex = 9; - this.BtnCheckForUpdate.Text = Languages.Main_CheckForUpdates; + this.BtnCheckForUpdate.Text = global::HASS.Agent.Resources.Localization.Languages.Main_CheckForUpdates; this.BtnCheckForUpdate.UseVisualStyleBackColor = false; this.BtnCheckForUpdate.Click += new System.EventHandler(this.BtnCheckForUpdate_Click); // diff --git a/src/HASS.Agent/Forms/Main.cs b/src/HASS.Agent/Forms/Main.cs index d6b1d59..d04183c 100644 --- a/src/HASS.Agent/Forms/Main.cs +++ b/src/HASS.Agent/Forms/Main.cs @@ -71,8 +71,8 @@ private async void Main_Load(object sender, EventArgs e) // create a hotkey listener Variables.HotKeyListener = new HotkeyListener(); - // load settings - var loaded = await SettingsManager.LoadAsync(); + // load entities + var loaded = await SettingsManager.LoadEntitiesAsync(); if (!loaded) { MessageBoxAdv.Show(Languages.Main_Load_MessageBox1, Variables.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -130,13 +130,21 @@ protected override void WndProc(ref Message m) /// /// Checks to see if we need to launch onboarding, and if so, does that /// - private static void ProcessOnboarding() + private void ProcessOnboarding() { - if (Variables.AppSettings.OnboardingStatus == OnboardingStatus.Completed || Variables.AppSettings.OnboardingStatus == OnboardingStatus.Aborted) return; + if (Variables.AppSettings.OnboardingStatus is OnboardingStatus.Completed or OnboardingStatus.Aborted) return; + // hide ourselves + ShowInTaskbar = false; + Opacity = 0; + // show onboarding using var onboarding = new Onboarding(); onboarding.ShowDialog(); + + // show ourselves + ShowInTaskbar = true; + Opacity = 100; } /// diff --git a/src/HASS.Agent/Forms/Onboarding.cs b/src/HASS.Agent/Forms/Onboarding.cs index d1b09c6..9dfc55f 100644 --- a/src/HASS.Agent/Forms/Onboarding.cs +++ b/src/HASS.Agent/Forms/Onboarding.cs @@ -1,4 +1,5 @@ using HASS.Agent.Functions; +using HASS.Agent.Resources.Localization; using Syncfusion.Windows.Forms; namespace HASS.Agent.Forms @@ -46,6 +47,16 @@ private void BtnClose_Click(object sender, EventArgs e) DialogResult = DialogResult.OK; } + /// + /// Reloads the control's language + /// + internal void ReloadControlLanguage() + { + BtnNext.Text = Languages.Onboarding_BtnNext; + BtnClose.Text = Languages.Onboarding_BtnClose; + BtnPrevious.Text = Languages.Onboarding_BtnPrevious; + } + private void Onboarding_FormClosing(object sender, FormClosingEventArgs e) { if (!_onboardingManager.ConfirmBeforeClose()) e.Cancel = true; diff --git a/src/HASS.Agent/Forms/QuickActions/QuickActionsMod.Designer.cs b/src/HASS.Agent/Forms/QuickActions/QuickActionsMod.Designer.cs index b6cc7a7..1649d5b 100644 --- a/src/HASS.Agent/Forms/QuickActions/QuickActionsMod.Designer.cs +++ b/src/HASS.Agent/Forms/QuickActions/QuickActionsMod.Designer.cs @@ -67,7 +67,7 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 4; - this.BtnStore.Text = Languages.QuickActionsMod_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.QuickActionsMod_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // @@ -124,14 +124,14 @@ private void InitializeComponent() // // LblLoading // - this.LblLoading.AutoSize = true; this.LblLoading.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblLoading.ForeColor = System.Drawing.Color.MediumSpringGreen; - this.LblLoading.Location = new System.Drawing.Point(44, 428); + this.LblLoading.Location = new System.Drawing.Point(0, 410); this.LblLoading.Name = "LblLoading"; - this.LblLoading.Size = new System.Drawing.Size(276, 19); + this.LblLoading.Size = new System.Drawing.Size(352, 41); this.LblLoading.TabIndex = 7; this.LblLoading.Text = Languages.QuickActionsMod_LblLoading; + this.LblLoading.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.LblLoading.Visible = false; // // LblEntity @@ -164,7 +164,7 @@ private void InitializeComponent() this.CbEnableHotkey.Name = "CbEnableHotkey"; this.CbEnableHotkey.Size = new System.Drawing.Size(114, 23); this.CbEnableHotkey.TabIndex = 17; - this.CbEnableHotkey.Text = Languages.QuickActionsMod_CbEnableHotkey; + this.CbEnableHotkey.Text = global::HASS.Agent.Resources.Localization.Languages.QuickActionsMod_CbEnableHotkey; this.CbEnableHotkey.UseVisualStyleBackColor = true; // // LblHotkey @@ -230,13 +230,13 @@ private void InitializeComponent() // // LblTip1 // - this.LblTip1.AutoSize = true; this.LblTip1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblTip1.Location = new System.Drawing.Point(92, 319); + this.LblTip1.Location = new System.Drawing.Point(12, 319); this.LblTip1.Name = "LblTip1"; - this.LblTip1.Size = new System.Drawing.Size(248, 15); + this.LblTip1.Size = new System.Drawing.Size(328, 15); this.LblTip1.TabIndex = 28; this.LblTip1.Text = Languages.QuickActionsMod_LblTip1; + this.LblTip1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // QuickActionsMod // diff --git a/src/HASS.Agent/Forms/Sensors/SensorsConfig.Designer.cs b/src/HASS.Agent/Forms/Sensors/SensorsConfig.Designer.cs index 4dc5b00..0b4b4cc 100644 --- a/src/HASS.Agent/Forms/Sensors/SensorsConfig.Designer.cs +++ b/src/HASS.Agent/Forms/Sensors/SensorsConfig.Designer.cs @@ -68,7 +68,7 @@ private void InitializeComponent() this.BtnRemove.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnRemove.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnRemove.TabIndex = 15; - this.BtnRemove.Text = Languages.SensorsConfig_BtnRemove; + this.BtnRemove.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsConfig_BtnRemove; this.BtnRemove.UseVisualStyleBackColor = false; this.BtnRemove.Click += new System.EventHandler(this.BtnRemove_Click); // @@ -90,7 +90,7 @@ private void InitializeComponent() this.BtnModify.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnModify.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnModify.TabIndex = 14; - this.BtnModify.Text = Languages.SensorsConfig_BtnModify; + this.BtnModify.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsConfig_BtnModify; this.BtnModify.UseVisualStyleBackColor = false; this.BtnModify.Click += new System.EventHandler(this.BtnModify_Click); // @@ -112,7 +112,7 @@ private void InitializeComponent() this.BtnAdd.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnAdd.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnAdd.TabIndex = 13; - this.BtnAdd.Text = Languages.SensorsConfig_BtnAdd; + this.BtnAdd.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsConfig_BtnAdd; this.BtnAdd.UseVisualStyleBackColor = false; this.BtnAdd.Click += new System.EventHandler(this.BtnAdd_Click); // @@ -135,7 +135,7 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 11; - this.BtnStore.Text = Languages.SensorsConfig_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsConfig_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // @@ -174,12 +174,12 @@ private void InitializeComponent() // // ClmName // - this.ClmName.Text = Languages.SensorsConfig_ClmName; + this.ClmName.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsConfig_ClmName; this.ClmName.Width = 300; // // ClmType // - this.ClmType.Text = Languages.SensorsConfig_ClmType; + this.ClmType.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsConfig_ClmType; this.ClmType.Width = 250; // // ClmRefresh @@ -203,7 +203,7 @@ private void InitializeComponent() this.LblRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.LblRefresh.AutoSize = true; this.LblRefresh.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblRefresh.Location = new System.Drawing.Point(585, 485); + this.LblRefresh.Location = new System.Drawing.Point(470, 486); this.LblRefresh.Name = "LblRefresh"; this.LblRefresh.Size = new System.Drawing.Size(43, 15); this.LblRefresh.TabIndex = 41; @@ -213,7 +213,7 @@ private void InitializeComponent() // this.PbRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.PbRefresh.Image = global::HASS.Agent.Properties.Resources.refresh_16; - this.PbRefresh.Location = new System.Drawing.Point(563, 484); + this.PbRefresh.Location = new System.Drawing.Point(448, 485); this.PbRefresh.Name = "PbRefresh"; this.PbRefresh.Size = new System.Drawing.Size(16, 16); this.PbRefresh.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; diff --git a/src/HASS.Agent/Forms/Sensors/SensorsConfig.resx b/src/HASS.Agent/Forms/Sensors/SensorsConfig.resx index 896b6e3..172fc92 100644 --- a/src/HASS.Agent/Forms/Sensors/SensorsConfig.resx +++ b/src/HASS.Agent/Forms/Sensors/SensorsConfig.resx @@ -65,7 +65,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAARgQAAAJNU0Z0AUkBTAMBAQAB - mAEAAZgBAAEQAQABEAEABP8BGQEACP8BQgFNATYHAAE2AwABKAMAAUADAAEQAwABAQEAARgGAAEMEgAB + oAEAAaABAAEQAQABEAEABP8BGQEACP8BQgFNATYHAAE2AwABKAMAAUADAAEQAwABAQEAARgGAAEMEgAB MAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0B MAItkAABMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATAC LQEwAi0BMAItkAABMAItATACLQEwAi0BMAItATACLQF6AngBsQKwAasDqQKoAbICsQGDAoEBMAItATAC diff --git a/src/HASS.Agent/Forms/Sensors/SensorsMod.Designer.cs b/src/HASS.Agent/Forms/Sensors/SensorsMod.Designer.cs index cee5451..fbb4b14 100644 --- a/src/HASS.Agent/Forms/Sensors/SensorsMod.Designer.cs +++ b/src/HASS.Agent/Forms/Sensors/SensorsMod.Designer.cs @@ -89,7 +89,7 @@ private void InitializeComponent() this.BtnStore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnStore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnStore.TabIndex = 5; - this.BtnStore.Text = Languages.SensorsMod_BtnStore; + this.BtnStore.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsMod_BtnStore; this.BtnStore.UseVisualStyleBackColor = false; this.BtnStore.Click += new System.EventHandler(this.BtnStore_Click); // @@ -161,7 +161,7 @@ private void InitializeComponent() // this.LblSeconds.AutoSize = true; this.LblSeconds.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.LblSeconds.Location = new System.Drawing.Point(750, 176); + this.LblSeconds.Location = new System.Drawing.Point(786, 174); this.LblSeconds.Name = "LblSeconds"; this.LblSeconds.Size = new System.Drawing.Size(58, 19); this.LblSeconds.TabIndex = 15; @@ -209,7 +209,7 @@ private void InitializeComponent() this.LblSetting2.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.LblSetting2.Location = new System.Drawing.Point(566, 288); this.LblSetting2.Name = "LblSetting2"; - this.LblSetting2.Size = new System.Drawing.Size(59, 19); + this.LblSetting2.Size = new System.Drawing.Size(63, 19); this.LblSetting2.TabIndex = 21; this.LblSetting2.Text = Languages.SensorsMod_LblSetting2; this.LblSetting2.Visible = false; @@ -258,7 +258,7 @@ private void InitializeComponent() this.NumInterval.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.NumInterval.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.NumInterval.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.NumInterval.Location = new System.Drawing.Point(661, 174); + this.NumInterval.Location = new System.Drawing.Point(673, 172); this.NumInterval.Maximum = new decimal(new int[] { 86400, 0, @@ -305,7 +305,7 @@ private void InitializeComponent() // // ClmSensorName // - this.ClmSensorName.Text = Languages.SensorsMod_ClmSensorName; + this.ClmSensorName.Text = global::HASS.Agent.Resources.Localization.Languages.SensorsMod_ClmSensorName; this.ClmSensorName.Width = 300; // // ClmMultiValue diff --git a/src/HASS.Agent/Forms/Sensors/SensorsMod.resx b/src/HASS.Agent/Forms/Sensors/SensorsMod.resx index ae79303..1791a2a 100644 --- a/src/HASS.Agent/Forms/Sensors/SensorsMod.resx +++ b/src/HASS.Agent/Forms/Sensors/SensorsMod.resx @@ -65,7 +65,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAADgoAAAJNU0Z0AUkBTAIBAQMB - AAFAAQABQAEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABGAYAAQwS + AAFIAQABSAEAARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABGAYAAQwS AAEwAi0BMAItATACLQEwAi0k8QEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0BMAItATACLQEwAi0B MAItATYCNAE5AjYBuwK6AZMCkgEwAi0BMAItATACLQEwAi0BOQI2AXsCeQGuAq0BPwI8ATACLQEwAi0B MwIwAaICoQFsAmoBMAItATACLQEwAi0BMAItMAABMAItATACLQEwAi0BMAItA/EBMAItATACLQEwAi0B diff --git a/src/HASS.Agent/Forms/UpdatePending.Designer.cs b/src/HASS.Agent/Forms/UpdatePending.Designer.cs index e193144..e8e20ba 100644 --- a/src/HASS.Agent/Forms/UpdatePending.Designer.cs +++ b/src/HASS.Agent/Forms/UpdatePending.Designer.cs @@ -64,7 +64,7 @@ private void InitializeComponent() this.BtnDownload.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnDownload.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnDownload.TabIndex = 0; - this.BtnDownload.Text = Languages.UpdatePending_BtnDownload; + this.BtnDownload.Text = global::HASS.Agent.Resources.Localization.Languages.UpdatePending_BtnDownload; this.BtnDownload.UseVisualStyleBackColor = false; this.BtnDownload.Click += new System.EventHandler(this.BtnDownload_Click); // @@ -113,9 +113,9 @@ private void InitializeComponent() this.BtnIgnore.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.BtnIgnore.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.BtnIgnore.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.BtnIgnore.Location = new System.Drawing.Point(-2, 465); + this.BtnIgnore.Location = new System.Drawing.Point(2, 465); this.BtnIgnore.Name = "BtnIgnore"; - this.BtnIgnore.Size = new System.Drawing.Size(158, 31); + this.BtnIgnore.Size = new System.Drawing.Size(154, 31); this.BtnIgnore.Style.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.BtnIgnore.Style.FocusedBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70))))); this.BtnIgnore.Style.FocusedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); @@ -124,7 +124,7 @@ private void InitializeComponent() this.BtnIgnore.Style.HoverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); this.BtnIgnore.Style.PressedForeColor = System.Drawing.Color.Black; this.BtnIgnore.TabIndex = 6; - this.BtnIgnore.Text = Languages.UpdatePending_BtnIgnore; + this.BtnIgnore.Text = global::HASS.Agent.Resources.Localization.Languages.UpdatePending_BtnIgnore; this.BtnIgnore.UseVisualStyleBackColor = false; this.BtnIgnore.Click += new System.EventHandler(this.BtnIgnore_Click); // diff --git a/src/HASS.Agent/Functions/HelperFunctions.cs b/src/HASS.Agent/Functions/HelperFunctions.cs index 019423c..8d5f4c2 100644 --- a/src/HASS.Agent/Functions/HelperFunctions.cs +++ b/src/HASS.Agent/Functions/HelperFunctions.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using System.Diagnostics; +using System.Globalization; using System.Reflection; using System.Runtime.InteropServices; using System.Security.Cryptography; diff --git a/src/HASS.Agent/Functions/LocalizationManager.cs b/src/HASS.Agent/Functions/LocalizationManager.cs new file mode 100644 index 0000000..6cfa582 --- /dev/null +++ b/src/HASS.Agent/Functions/LocalizationManager.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HASS.Agent.Models.Internal; +using Serilog; + +namespace HASS.Agent.Functions +{ + [SuppressMessage("ReSharper", "InconsistentNaming")] + internal static class LocalizationManager + { + /// + /// Loads supported languages, and tries to set the stored language as the current UI language + /// + internal static void Initialize() + { + // load supported languages + LoadSupportedUILanguages(); + + // set stored + SetStoredUILanguage(); + } + + /// + /// Sets the UI culture to the provided culturecode + /// + // ReSharper disable once InconsistentNaming + private static void SetStoredUILanguage() + { + var cultureCode = Variables.AppSettings?.InterfaceLanguage; + + try + { + if (string.IsNullOrWhiteSpace(cultureCode)) + { + // nothing set, get system culture + var currentCulture = CultureInfo.CurrentUICulture; + cultureCode = currentCulture.Name; + + Log.Information("[LOCALIZTION] No language setting stored, falling back to the system's UI culture: {culture}", currentCulture.DisplayName); + } + + // load the culture (and trigger a not-found exception if it's malformed) + var culture = new CultureInfo(cultureCode); + + // check if it's supported + if (Variables.SupportedUILanguages.All(x => x.Name != culture.Name)) + { + Log.Warning("[LOCALIZATION] The selected UI culture isn't yet supported, please help out by translating:"); + Log.Warning("[LOCALIZATION] https://github.com/LAB02-Research/HASS.Agent/wiki/Translating"); + + SetDefaultUILanguage(); + return; + } + + // store as current + Variables.CurrentUICulture = new SupportedUILanguage(culture); + + // set as interface + Thread.CurrentThread.CurrentUICulture = culture; + Thread.CurrentThread.CurrentCulture = culture; + + Log.Information("[LOCALIZATION] Selected UI culture: [{code}] {culture}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.DisplayName); + } + catch (CultureNotFoundException) + { + Log.Error("[LOCALIZATION] Unable to set the selected culture '{culture}': {err}", cultureCode, "culture not known"); + SetDefaultUILanguage(); + } + catch (Exception ex) + { + Log.Error("[LOCALIZATION] Unable to set the selected culture '{culture}': {err}", cultureCode, ex.Message); + SetDefaultUILanguage(); + } + } + + /// + /// Tries to change the interface to the provided one + /// + /// + internal static void SetNewUILanguage(string cultureCode) + { + try + { + if (string.IsNullOrWhiteSpace(cultureCode)) return; + + // load the culture (and trigger a not-found exception if it's malformed) + var culture = new CultureInfo(cultureCode); + + // check if it's supported + if (Variables.SupportedUILanguages.All(x => x.Name != culture.Name)) + { + Log.Warning("[LOCALIZATION] The new UI culture isn't yet supported, please help out by translating:"); + Log.Warning("[LOCALIZATION] https://github.com/LAB02-Research/HASS.Agent/wiki/Translating"); + + SetStoredUILanguage(); + return; + } + + // store as current + Variables.CurrentUICulture = new SupportedUILanguage(culture); + + // set as interface + Thread.CurrentThread.CurrentUICulture = culture; + Thread.CurrentThread.CurrentCulture = culture; + + Log.Information("[LOCALIZATION] New UI culture: [{code}] {culture}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.DisplayName); + } + catch (CultureNotFoundException) + { + Log.Error("[LOCALIZATION] Unable to set the new culture '{culture}': {err}", cultureCode, "culture not known"); + SetDefaultUILanguage(); + } + catch (Exception ex) + { + Log.Error("[LOCALIZATION] Unable to set the new culture '{culture}': {err}", cultureCode, ex.Message); + SetDefaultUILanguage(); + } + } + + /// + /// Sets the UI to the default language + /// + private static void SetDefaultUILanguage() + { + // set default EN + var defaultCulture = new CultureInfo("en"); + Log.Information("[LOCALIZATION] Setting default: {default}", defaultCulture.DisplayName); + Thread.CurrentThread.CurrentUICulture = defaultCulture; + + // store as current + Variables.CurrentUICulture = new SupportedUILanguage(defaultCulture); + } + + /// + /// Loads the currently supported UI languages + /// + private static void LoadSupportedUILanguages() + { + var supportedCultureList = new List { "en", "pt-BR" }; + + foreach (var supportedUILanguage in supportedCultureList.Select(supportedCulture => new CultureInfo(supportedCulture)).Select(culture => new SupportedUILanguage(culture))) + { + Variables.SupportedUILanguages.Add(supportedUILanguage); + } + } + } +} diff --git a/src/HASS.Agent/Functions/OnboardingManager.cs b/src/HASS.Agent/Functions/OnboardingManager.cs index e309ac5..bdfd23d 100644 --- a/src/HASS.Agent/Functions/OnboardingManager.cs +++ b/src/HASS.Agent/Functions/OnboardingManager.cs @@ -14,7 +14,7 @@ internal class OnboardingManager private readonly Onboarding _onboarding; private Control _currentControl; - private const int _totalOnboardingSteps = 9; + private const int TOTAL_ONBOARDING_STEPS = 9; internal OnboardingManager(Onboarding onboarding) { @@ -179,9 +179,16 @@ private bool StoreCurrentControl() switch (Variables.AppSettings.OnboardingStatus) { case OnboardingStatus.NeverDone: - { - var obj = (OnboardingWelcome)_currentControl; - return obj.Store(); + { + var obj = (OnboardingWelcome)_currentControl; + var stored = obj.Store(out var languageChanged); + if (!stored) return false; + + // reload ui? + if (languageChanged) _onboarding.ReloadControlLanguage(); + + // done + return true; } case OnboardingStatus.Notifications: @@ -253,13 +260,13 @@ private void ShowWelcome() const int onboardingStep = 1; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Start, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Start, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.NeverDone; _currentControl = new OnboardingWelcome(); _onboarding.BtnPrevious.Visible = false; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; LoadCurrentControl(); } @@ -273,13 +280,13 @@ private void ShowStartup() const int onboardingStep = 2; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Startup, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Startup, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.Startup; _currentControl = new OnboardingStartup(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; LoadCurrentControl(); } @@ -293,13 +300,13 @@ private void ShowNotifications() const int onboardingStep = 3; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Notifications, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Notifications, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.Notifications; _currentControl = new OnboardingNotifications(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; LoadCurrentControl(); } @@ -313,13 +320,13 @@ private void ShowIntegration() const int onboardingStep = 4; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Integration, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Integration, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.Integration; _currentControl = new OnboardingIntegration(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; LoadCurrentControl(); } @@ -334,13 +341,13 @@ private void ShowAPI() const int onboardingStep = 5; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Api, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Api, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.API; _currentControl = new OnboardingApi(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; LoadCurrentControl(); } @@ -355,13 +362,13 @@ private void ShowMQTT() const int onboardingStep = 6; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Mqtt, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Mqtt, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.MQTT; _currentControl = new OnboardingMqtt(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; LoadCurrentControl(); } @@ -375,13 +382,13 @@ private void ShowHotKey() const int onboardingStep = 7; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_HotKey, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_HotKey, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.HotKey; _currentControl = new OnboardingHotKey(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; LoadCurrentControl(); } @@ -395,13 +402,13 @@ private void ShowUpdates() const int onboardingStep = 8; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Updates, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Updates, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.Updates; _currentControl = new OnboardingUpdates(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "next"; + _onboarding.BtnNext.Text = Languages.Onboarding_BtnNext; _onboarding.BtnClose.Visible = true; @@ -417,13 +424,13 @@ private void ShowDone() const int onboardingStep = 9; - _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Completed, onboardingStep, _totalOnboardingSteps); + _onboarding.Text = string.Format(Languages.OnboardingManager_OnboardingTitle_Completed, onboardingStep, TOTAL_ONBOARDING_STEPS); Variables.AppSettings.OnboardingStatus = OnboardingStatus.Completed; _currentControl = new OnboardingDone(); _onboarding.BtnPrevious.Visible = true; - _onboarding.BtnNext.Text = "finish"; + _onboarding.BtnNext.Text = Languages.OnboardingManager_BtnNext_Finish; _onboarding.BtnClose.Visible = false; diff --git a/src/HASS.Agent/HASS.Agent.csproj b/src/HASS.Agent/HASS.Agent.csproj index 325c883..2fa43c5 100644 --- a/src/HASS.Agent/HASS.Agent.csproj +++ b/src/HASS.Agent/HASS.Agent.csproj @@ -11,7 +11,7 @@ x64 AnyCPU;x64 portable - 2022.4.1.0 + 2022.4.2.0 LAB02 Research LAB02 Research Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more. diff --git a/src/HASS.Agent/Models/Config/AppSettings.cs b/src/HASS.Agent/Models/Config/AppSettings.cs index 260d700..5dc7c03 100644 --- a/src/HASS.Agent/Models/Config/AppSettings.cs +++ b/src/HASS.Agent/Models/Config/AppSettings.cs @@ -12,6 +12,7 @@ public AppSettings() public OnboardingStatus OnboardingStatus { get; set; } = OnboardingStatus.NeverDone; public string DeviceName { get; set; } = Environment.MachineName; + public string InterfaceLanguage { get; set; } = string.Empty; public bool CheckForUpdates { get; set; } = true; public string LastUpdateNotificationShown { get; set; } = string.Empty; diff --git a/src/HASS.Agent/Models/Internal/SupportedUILanguage.cs b/src/HASS.Agent/Models/Internal/SupportedUILanguage.cs new file mode 100644 index 0000000..c783686 --- /dev/null +++ b/src/HASS.Agent/Models/Internal/SupportedUILanguage.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HASS.Agent.Models.Internal +{ + [SuppressMessage("ReSharper", "InconsistentNaming")] + public class SupportedUILanguage + { + public SupportedUILanguage() + { + // + } + + public SupportedUILanguage(CultureInfo cultureInfo) + { + Culture = cultureInfo; + Name = cultureInfo.Name; + DisplayName = cultureInfo.EnglishName; + } + + public CultureInfo Culture { get; set; } + public string Name { get; set; } + public string DisplayName { get; set; } + } +} diff --git a/src/HASS.Agent/Program.cs b/src/HASS.Agent/Program.cs index 13ccdad..c1b4534 100644 --- a/src/HASS.Agent/Program.cs +++ b/src/HASS.Agent/Program.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Globalization; using HASS.Agent.Enums; using HASS.Agent.Forms; using HASS.Agent.Forms.ChildApplications; @@ -14,7 +15,7 @@ internal static class Program /// Main entry point /// [STAThread] - private static void Main(string[] args) + private static async Task Main(string[] args) { try { @@ -23,7 +24,7 @@ private static void Main(string[] args) // get logging settings Variables.ExtendedLogging = SettingsManager.GetExtendedLoggingSetting(); - + // enable logging LoggingManager.PrepareLogging(); @@ -33,11 +34,26 @@ private static void Main(string[] args) AppDomain.CurrentDomain.FirstChanceException += LoggingManager.CurrentDomainOnFirstChanceException; } else Log.Information("[PROGRAM] Extended logging disabled"); - + // prepare application Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + // check if we're a child application + var childApp = LaunchAsChildApplication(args); + + // load app settings + var settingsLoaded = await SettingsManager.LoadAsync(!childApp); + if (!settingsLoaded) + { + Log.Error("[PROGRAM] Something went wrong while loading the settings. Check appsettings.json, or delete the file to start fresh."); + Log.CloseAndFlush(); + return; + } + + // set ui culture + LocalizationManager.Initialize(); + // set scaling Application.SetHighDpiMode(HighDpiMode.DpiUnawareGdiScaled); @@ -73,7 +89,24 @@ private static void Main(string[] args) } /// - /// Checks the provided arguments to see if we need to launch as a task-specific child application + /// Checks whether we're asked to launch as a child application + /// + /// + /// + internal static bool LaunchAsChildApplication(string[] args) + { + return args.Any(x => x == "update") + || args.Any(x => x == "portreservation") + || args.Any(x => x == "restart") + || args.Any(x => x == "service_disable") + || args.Any(x => x == "service_enabled") + || args.Any(x => x == "service_start") + || args.Any(x => x == "service_stop") + || args.Any(x => x == "service_reinstall"); + } + + /// + /// Launches as a child application according to the provided arguments /// /// /// diff --git a/src/HASS.Agent/Resources/Localization/Languages.pt-br.resx b/src/HASS.Agent/Resources/Localization/Languages.pt-br.resx index 7b4b551..ee577ef 100644 --- a/src/HASS.Agent/Resources/Localization/Languages.pt-br.resx +++ b/src/HASS.Agent/Resources/Localization/Languages.pt-br.resx @@ -1,5 +1,5 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 fechar @@ -131,17 +131,20 @@ páginas dos componentes usados ​​para suas licenças individuais: - Um grande 'obrigado' aos desenvolvedores desses projetos, que foram gentis o + Um grande 'obrigado' aos desenvolvedores desses projetos, que foram gentis o suficiente para compartilhar seu trabalho duro com o resto de nós, meros mortais. - E claro; obrigado a Paulus Shoutsen, Franck Nijhof e toda a equipe de + E claro; obrigado a Paulus Shoutsen, Franck Nijhof e toda a equipe de desenvolvedores que criaram e mantêm o Home Assistant :-) - Gostou deste programa? Apoie-nos (leia-se: mantenha-nos acordados) comprando + Gostou deste programa? Apoie-nos (leia-se: mantenha-nos acordados) comprando uma xícara de café: + + ou + Sobre @@ -468,7 +471,7 @@ Consulte os logs para mais informações. Esta página permite configurar ligações com ferramentas externas. - Por padrão, o HASS.Agent iniciará URLs usando seu navegador padrão. Se você quiser, + Por padrão, o HASS.Agent iniciará URLs usando seu navegador padrão. Se você quiser, você também pode configurar um navegador específico. Além disso, você pode configurar os argumentos usados ​​para iniciar em modo privado. @@ -492,22 +495,25 @@ Use o comando 'custom executor' para iniciar este executor. segundos - Esta página contém itens de configuração geral. Para obter mais configurações, + Esta página contém itens de configuração geral. Para obter mais configurações, navegue pelas guias à esquerda. - O nome do dispositivo é usado para identificar sua máquina no HA. Também é usado + O nome do dispositivo é usado para identificar sua máquina no HA. Também é usado como um prefixo para seus nomes de comando/sensor (pode ser alterado por entidade). - Importante: se você alterar esse valor, o HASS.Agent cancelará a publicação de todos os + Importante: se você alterar esse valor, o HASS.Agent cancelará a publicação de todos os seus sensores e comandos e forçará uma reinicialização, para que possam ser republicados com o novo nome do dispositivo. Suas automações e scripts continuarão funcionando. - O HASS.Agent aguardará um pouco antes de notificá-lo sobre desconexões da API do + O HASS.Agent aguardará um pouco antes de notificá-lo sobre desconexões da API do MQTT ou HA. Você pode definir a quantidade de segundos aqui. + + idioma da interface + teste de conexão @@ -560,7 +566,7 @@ Você pode obter um token através da sua página de perfil. Role até o final e combinação de atalhos - Uma maneira fácil de puxar suas ações é usar uma tecla de atalho rápido. + Uma maneira fácil de puxar suas ações é usar uma tecla de atalho rápido. Dessa forma, independentemente do que estiver fazendo em sua máquina, você sempre poderá interagir com o Home Assistant. @@ -584,9 +590,9 @@ poderá interagir com o Home Assistant. local do cache de imagem - As imagens mostradas nas notificações devem ser armazenadas temporariamente localmente. + As imagens mostradas nas notificações devem ser armazenadas temporariamente localmente. Você pode configurar a quantidade de dias eles devem ser mantidos antes que o HASS.Agent -os exclua. Digite '0' para mantê-los permanentemente. +os exclua. Digite '0' para mantê-los permanentemente. abrir pasta de logs @@ -595,7 +601,7 @@ os exclua. Digite '0' para mantê-los permanentemente. habilitar log estendido - O log estendido fornece um log mais detalhado e detalhado, caso o log padrão não seja + O log estendido fornece um log mais detalhado e detalhado, caso o log padrão não seja suficiente. Observe que habilitar isso pode fazer com que os arquivos de log fiquem grandes e só devem ser usado quando você suspeita que algo está errado com o próprio HASS.Agent ou quando solicitado pelo desenvolvedores. @@ -751,11 +757,11 @@ Verifique os logs do HASS.Agent (não do serviço) para obter mais informações falhou - O serviço satélite permite que você execute sensores e comandos mesmo quando nenhum usuário -estiver conectado. Use o botão 'serviço de satélite' na janela principal para gerenciá-lo. + O serviço satélite permite que você execute sensores e comandos mesmo quando nenhum usuário +estiver conectado. Use o botão 'serviço de satélite' na janela principal para gerenciá-lo. - Se você não configurar o serviço, ele não fará nada. No entanto, você ainda pode decidir desativá-lo + Se você não configurar o serviço, ele não fará nada. No entanto, você ainda pode decidir desativá-lo também. O instalador deixará o serviço desativado sozinho (se você remover o serviço, o instalador o reinstalará). @@ -804,7 +810,7 @@ Verifique os logs para obter mais informações. ativado - O HASS.Agent pode ser iniciado quando você efetua login criando uma entrada no registro + O HASS.Agent pode ser iniciado quando você efetua login criando uma entrada no registro do seu perfil de usuário. Como o HASS.Agent é baseado no usuário, se você quiser iniciar para outro usuário, basta @@ -823,13 +829,13 @@ instalar e configurar o HASS.Agent lá. notifique-me quando uma nova versão estiver disponível - Se você quiser, o HASS.Agent pode verificar atualizações em segundo plano. + Se você quiser, o HASS.Agent pode verificar atualizações em segundo plano. Você receberá uma notificação (uma vez por atualização), informando que uma nova versão está pronta para ser instalada. - Quando houver uma atualização, o HASS.Agent oferecerá a opção de abrir a página + Quando houver uma atualização, o HASS.Agent oferecerá a opção de abrir a página de lançamento. Mas se você quiser, o HASS.Agent também pode baixar e iniciar o instalador para você - menos para você fazer! @@ -847,6 +853,9 @@ O certificado do arquivo baixado será verificado antes da execução. guardar configuração + + ocupado, aguarde.. + Algo deu errado ao se preparar para reiniciar. Por favor, reinicie manualmente. @@ -882,7 +891,7 @@ O HASS.Agent agora será reiniciado para ativar a nova configuração. Deseja reiniciar agora? - Ferramentas Externas + Ferramentas Externas Geral @@ -979,17 +988,20 @@ Deseja reiniciar agora? Fórum Home Assistant - Um pouco de tudo, além de que outros usuários + Um pouco de tudo, além de que outros usuários do HA também podem ajudar. - Gostou de usar o HASS.Agent, precisa de ajuda para integrar + Gostou de usar o HASS.Agent, precisa de ajuda para integrar sensores/comandos ou tem uma grande ideia para a próxima versão? Existem alguns canais pelos quais você pode entrar em contato conosco: + + Wiki + Documentação e exemplos de uso. @@ -997,34 +1009,34 @@ conosco: Ajuda - + atalho rápido - + configuração - + carregando - + comandos ocultar - + sensores locais - + carregando - + serviço satélite @@ -1048,6 +1060,9 @@ serviço satélite home assistant api: + + mqtt: + api notificações: @@ -1151,12 +1166,12 @@ Versão do Home Assistant: {0} token api - Para saber quais entidades você configurou e enviar ações nos atalhos rápidos, o + Para saber quais entidades você configurou e enviar ações nos atalhos rápidos, o HASS.Agent usa API do Home Assistant. Forneça um token de acesso de longa duração e o endereço da sua instância do Home Assistant. Você pode obter um token através da sua página de perfil. Role até o final e -clique em 'CRIAR TOKEN'. +clique em 'CRIAR TOKEN'. server uri (deve estar bem assim) @@ -1189,13 +1204,13 @@ Se você encontrar algum problema, crie um ticket na página do GitHub. combinação de atalhos - Uma maneira fácil de puxar seus atalhos rápidos é usar uma tecla de atalho. + Uma maneira fácil de puxar seus atalhos rápidos é usar uma tecla de atalho. Dessa forma, independentemente do que estiver fazendo em sua máquina, você sempre poderá interagir com o Home Assistant. - Para usar notificações, você precisa instalar e configurar a integração HASS.Agent-notifier + Para usar notificações, você precisa instalar e configurar a integração HASS.Agent-notifier no Home Assistant. Isso é muito fácil usando o HACS, mas você também pode instalar manualmente. Acesse o @@ -1212,6 +1227,9 @@ link abaixo para mais informações. Página do GitHub do HASS.Agent-Notifier + + terminar + Tem certeza de que deseja abortar o processo de integração? @@ -1307,7 +1325,7 @@ Deseja habilitar esta função? Um segundo, determinando o estado atual .. - O HASS.Agent pode ser iniciado quando você faz login no Windows, criando uma chave + O HASS.Agent pode ser iniciado quando você faz login no Windows, criando uma chave de registro no seu perfil de usuário. Você sempre pode remover (ou recriar) essa chave por meio da janela Configuração. @@ -1319,7 +1337,7 @@ Você sempre pode remover (ou recriar) essa chave por meio da janela Configuraç sim, notifique-me sobre novas atualizações - Se você quiser, o HASS.Agent pode verificar atualizações em segundo plano. + Se você quiser, o HASS.Agent pode verificar atualizações em segundo plano. Você receberá uma notificação (uma vez por atualização), informando que uma nova versão está pronta para ser instalada. @@ -1327,7 +1345,7 @@ está pronta para ser instalada. Deseja habilitar esta funcionalidade? - Quando houver uma atualização, o HASS.Agent oferecerá a opção de abrir a página de + Quando houver uma atualização, o HASS.Agent oferecerá a opção de abrir a página de lançamentos. Mas se você quiser, o HASS.Agent também pode baixar e iniciar o instalador para você - menos para você fazer! @@ -1345,6 +1363,9 @@ Se você quiser, podemos passar pela configuração. Se não, basta clicar em &a O nome do dispositivo é usado para identificar sua máquina no HA. Também é usado como um prefixo sugerido para seus comandos e sensores. + + idioma da interface + Aguarde um pouco enquanto a tarefa é executada .. @@ -1781,16 +1802,16 @@ Essa é uma solicitação cara, portanto, o intervalo recomendado é de 15 minut comandos guardados! - Comandos + Comandos - Geral + Geral - MQTT + MQTT - Sensores + Sensores Serviços Satélite Config @@ -1983,7 +2004,7 @@ Tem certeza de que quer isso? prefixo de descoberta - Comandos e sensores são enviados através do MQTT. Forneça credenciais para o seu servidor. Se você estiver usando + Comandos e sensores são enviados através do MQTT. Forneça credenciais para o seu servidor. Se você estiver usando o complemento HA, você provavelmente pode usar o endereço predefinido. @@ -2007,6 +2028,21 @@ o complemento HA, você provavelmente pode usar o endereço predefinido. dica: clique duas vezes nesses campos para navegar + + configuração ausente + + + conectado + + + conectando .. + + + desconectado + + + erro + erro ao buscar o status, verifique os logs @@ -2200,10 +2236,4 @@ A página de lançamento agora será aberta. Atualização BETA do HASS.Agent - - mqtt: - - - Wiki - \ No newline at end of file diff --git a/src/HASS.Agent/Settings/SettingsManager.cs b/src/HASS.Agent/Settings/SettingsManager.cs index 7fec01d..dc2126b 100644 --- a/src/HASS.Agent/Settings/SettingsManager.cs +++ b/src/HASS.Agent/Settings/SettingsManager.cs @@ -23,22 +23,11 @@ internal class SettingsManager /// Load all stored settings and objects /// /// - /// /// - internal static async Task LoadAsync(bool createInitialSettings = true, bool loadEntities = true) + internal static async Task LoadAsync(bool createInitialSettings = true) { Log.Information("[SETTINGS] Config storage path: {path}", Variables.ConfigPath); - - // load command & sensor info cards - if (loadEntities) - { - await Task.Run(delegate - { - CommandsManager.LoadCommandInfo(); - SensorsManager.LoadSensorInfo(); - }); - } - + // check config dir if (!Directory.Exists(Variables.ConfigPath)) { @@ -65,24 +54,38 @@ await Task.Run(delegate var allGood = true; // load app settings - var ok = LoadAppSettings(); + var ok = await Task.Run(LoadAppSettings); if (!ok) allGood = false; + + // done + return allGood; + } - // only load other entities if we're asked to - if (loadEntities) + /// + /// Loads all entities (quick actions, commands and sensors) + /// + /// + internal static async Task LoadEntitiesAsync() + { + var allGood = true; + + await Task.Run(delegate { - // load quick actions - ok = StoredQuickActions.Load(); - if (!ok) allGood = false; + CommandsManager.LoadCommandInfo(); + SensorsManager.LoadSensorInfo(); + }); - // load commands - ok = await StoredCommands.LoadAsync(); - if (!ok) allGood = false; + // load quick actions + var ok = StoredQuickActions.Load(); + if (!ok) allGood = false; - // load sensors - ok = await StoredSensors.LoadAsync(); - if (!ok) allGood = false; - } + // load commands + ok = await StoredCommands.LoadAsync(); + if (!ok) allGood = false; + + // load sensors + ok = await StoredSensors.LoadAsync(); + if (!ok) allGood = false; // done return allGood; diff --git a/src/HASS.Agent/Variables.cs b/src/HASS.Agent/Variables.cs index 0563d55..866a872 100644 --- a/src/HASS.Agent/Variables.cs +++ b/src/HASS.Agent/Variables.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.Reflection; using Grapevine; using HASS.Agent.Forms; @@ -46,6 +47,12 @@ public static class Variables internal static Random Rnd { get; } = new(); internal static Font DefaultFont { get; } = new("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point); + /// + /// Localization + /// + internal static List SupportedUILanguages { get; } = new(); + internal static SupportedUILanguage CurrentUICulture { get; set; } = new(new CultureInfo("en")); + /// /// MQTT ///