From 38416cb6756d70f3c1e320a289b2c437d214c628 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 30 Jul 2022 23:34:45 +0200 Subject: [PATCH] Implemented adding of additional cultures --- .../Components/Settings.Designer.cs | 47 +++++++++++++++++- .../UI WinForms/Components/Settings.cs | 29 ++++++++--- .../UI WinForms/Components/Settings.resx | 3 ++ .../UI WinForms/Resources/Icons.Designer.cs | 10 ++++ .../UI WinForms/Resources/Icons.resx | 3 ++ .../Resources/icons8-collectibles-512.png | Bin 0 -> 2529 bytes 6 files changed, 84 insertions(+), 8 deletions(-) create mode 100644 I18N Commander/UI WinForms/Resources/icons8-collectibles-512.png diff --git a/I18N Commander/UI WinForms/Components/Settings.Designer.cs b/I18N Commander/UI WinForms/Components/Settings.Designer.cs index 3b0c22b..e38eb64 100644 --- a/I18N Commander/UI WinForms/Components/Settings.Designer.cs +++ b/I18N Commander/UI WinForms/Components/Settings.Designer.cs @@ -28,11 +28,16 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.tableLayout = new System.Windows.Forms.TableLayoutPanel(); this.labelHeadIcon = new System.Windows.Forms.Label(); this.labelHead = new System.Windows.Forms.Label(); this.panelSettings = new System.Windows.Forms.Panel(); + this.flowLayoutToolbar = new System.Windows.Forms.FlowLayoutPanel(); + this.buttonAddCulture = new System.Windows.Forms.Button(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.tableLayout.SuspendLayout(); + this.flowLayoutToolbar.SuspendLayout(); this.SuspendLayout(); // // tableLayout @@ -43,12 +48,14 @@ this.tableLayout.Controls.Add(this.labelHeadIcon, 0, 0); this.tableLayout.Controls.Add(this.labelHead, 1, 0); this.tableLayout.Controls.Add(this.panelSettings, 0, 1); + this.tableLayout.Controls.Add(this.flowLayoutToolbar, 0, 2); this.tableLayout.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayout.Location = new System.Drawing.Point(0, 0); this.tableLayout.Name = "tableLayout"; - this.tableLayout.RowCount = 2; + this.tableLayout.RowCount = 3; this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 66F)); this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 66F)); this.tableLayout.Size = new System.Drawing.Size(1001, 381); this.tableLayout.TabIndex = 1; // @@ -83,9 +90,41 @@ this.panelSettings.Location = new System.Drawing.Point(0, 66); this.panelSettings.Margin = new System.Windows.Forms.Padding(0); this.panelSettings.Name = "panelSettings"; - this.panelSettings.Size = new System.Drawing.Size(1001, 315); + this.panelSettings.Size = new System.Drawing.Size(1001, 249); this.panelSettings.TabIndex = 2; // + // flowLayoutToolbar + // + this.tableLayout.SetColumnSpan(this.flowLayoutToolbar, 2); + this.flowLayoutToolbar.Controls.Add(this.buttonAddCulture); + this.flowLayoutToolbar.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutToolbar.Location = new System.Drawing.Point(0, 315); + this.flowLayoutToolbar.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutToolbar.Name = "flowLayoutToolbar"; + this.flowLayoutToolbar.Size = new System.Drawing.Size(1001, 66); + this.flowLayoutToolbar.TabIndex = 3; + // + // buttonAddCulture + // + this.buttonAddCulture.FlatAppearance.BorderSize = 0; + this.buttonAddCulture.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonAddCulture.Image = global::UI_WinForms.Resources.Icons.icons8_collectibles_512; + this.buttonAddCulture.Location = new System.Drawing.Point(3, 3); + this.buttonAddCulture.Name = "buttonAddCulture"; + this.buttonAddCulture.Size = new System.Drawing.Size(60, 60); + this.buttonAddCulture.TabIndex = 0; + this.toolTip.SetToolTip(this.buttonAddCulture, "Add another culture"); + this.buttonAddCulture.UseVisualStyleBackColor = true; + this.buttonAddCulture.Click += new System.EventHandler(this.buttonAddCulture_Click); + // + // toolTip + // + this.toolTip.AutoPopDelay = 30000; + this.toolTip.InitialDelay = 500; + this.toolTip.ReshowDelay = 100; + this.toolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; + this.toolTip.ToolTipTitle = "Help"; + // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); @@ -96,6 +135,7 @@ this.Size = new System.Drawing.Size(1001, 381); this.tableLayout.ResumeLayout(false); this.tableLayout.PerformLayout(); + this.flowLayoutToolbar.ResumeLayout(false); this.ResumeLayout(false); } @@ -106,5 +146,8 @@ private Label labelHeadIcon; private Label labelHead; private Panel panelSettings; + private FlowLayoutPanel flowLayoutToolbar; + private ToolTip toolTip; + private Button buttonAddCulture; } } diff --git a/I18N Commander/UI WinForms/Components/Settings.cs b/I18N Commander/UI WinForms/Components/Settings.cs index dcbef4c..cb6f551 100644 --- a/I18N Commander/UI WinForms/Components/Settings.cs +++ b/I18N Commander/UI WinForms/Components/Settings.cs @@ -1,14 +1,31 @@ -namespace UI_WinForms.Components; +using Processor; + +namespace UI_WinForms.Components; public partial class Settings : UserControl { public Settings() { this.InitializeComponent(); - this.Load += async (sender, args) => - { - foreach (var setting in Setting.GetAllSettings()) - this.panelSettings.Controls.Add(await setting); - }; + this.Load += async (sender, args) => await this.LoadAllSettings(); + } + + private async Task LoadAllSettings() + { + this.panelSettings.Controls.Clear(); + foreach (var setting in Setting.GetAllSettings()) + this.panelSettings.Controls.Add(await setting); + } + + private async void buttonAddCulture_Click(object sender, EventArgs e) + { + // Get the current number of cultures: + var numberCultures = await AppSettings.GetNumberCultures(); + + // Add a new culture: + await AppSettings.SetCultureCode(++numberCultures, string.Empty); + + // Reload all settings: + await this.LoadAllSettings(); } } diff --git a/I18N Commander/UI WinForms/Components/Settings.resx b/I18N Commander/UI WinForms/Components/Settings.resx index b5ae26c..99de901 100644 --- a/I18N Commander/UI WinForms/Components/Settings.resx +++ b/I18N Commander/UI WinForms/Components/Settings.resx @@ -57,4 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/I18N Commander/UI WinForms/Resources/Icons.Designer.cs b/I18N Commander/UI WinForms/Resources/Icons.Designer.cs index f0d5fcd..6a7f135 100644 --- a/I18N Commander/UI WinForms/Resources/Icons.Designer.cs +++ b/I18N Commander/UI WinForms/Resources/Icons.Designer.cs @@ -120,6 +120,16 @@ namespace UI_WinForms.Resources { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_collectibles_512 { + get { + object obj = ResourceManager.GetObject("icons8_collectibles_512", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/I18N Commander/UI WinForms/Resources/Icons.resx b/I18N Commander/UI WinForms/Resources/Icons.resx index a18a78c..e23ca7c 100644 --- a/I18N Commander/UI WinForms/Resources/Icons.resx +++ b/I18N Commander/UI WinForms/Resources/Icons.resx @@ -136,6 +136,9 @@ icons8-cancel-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + icons8-collectibles-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + icons8-delete-folder-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/I18N Commander/UI WinForms/Resources/icons8-collectibles-512.png b/I18N Commander/UI WinForms/Resources/icons8-collectibles-512.png new file mode 100644 index 0000000000000000000000000000000000000000..929c2a4389e64a58b748b042223bcf2a98ecb1c4 GIT binary patch literal 2529 zcmai030PBC77j~`f-Iudh+BBUU9y6bKwyAqWeFmo5Eciryd*D>ypRMEtn8I4)Fu6p z)v72|hE0WvB3MunY6L+UT#6tSq@buUj4aCM%uAq9tIp*6UXpwN|N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