I18NCommander/I18N Commander/UI WinForms/Components/Settings.cs

32 lines
891 B
C#

using Processor;
namespace UI_WinForms.Components;
public partial class Settings : UserControl
{
public Settings()
{
this.InitializeComponent();
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();
}
}