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 0000000..929c2a4 Binary files /dev/null and b/I18N Commander/UI WinForms/Resources/icons8-collectibles-512.png differ