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

32 lines
900 B
C#
Raw Normal View History

using Processor;
namespace UI_WinForms.Components;
2022-07-26 17:08:47 +00:00
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 indices of cultures:
var cultureIndices = await AppSettings.GetCultureIndices();
// Add a new culture:
await AppSettings.SetCultureCode(cultureIndices.Max() + 1, string.Empty);
// Reload all settings:
await this.LoadAllSettings();
2022-07-26 17:08:47 +00:00
}
}