mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 15:41:49 +01:00
Merge branch 'language-switch-propery-fix' of https://github.com/czukowski/DS4Windows into czukowski-language-switch-propery-fix
This commit is contained in:
commit
cf4a754f5f
@ -55,7 +55,6 @@
|
||||
this.Controls.Add(this.cbCulture);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "LanguagePackComboBox";
|
||||
this.Load += new System.EventHandler(this.LanguagePackComboBox_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.LanguagePackComboBox_SizeChanged);
|
||||
this.Resize += new System.EventHandler(this.LanguagePackComboBox_SizeChanged);
|
||||
this.ResumeLayout(false);
|
||||
|
@ -16,6 +16,12 @@ namespace DS4Windows.DS4Forms
|
||||
private string InvariantCultureTextValue = "No (English UI)";
|
||||
private TaskCompletionSource<bool> LanguageListInitialized = new TaskCompletionSource<bool>();
|
||||
|
||||
// If probing path has been changed in App.config, add the same string here.
|
||||
public string ProbingPath = "Lang";
|
||||
|
||||
// Filter language assembly file names in order to ont include irrelevant assemblies to the combo box.
|
||||
public string LanguageAssemblyName = "DS4Windows.resources.dll";
|
||||
|
||||
[Category("Action")]
|
||||
[Description("Fires when the combo box selected index is changed.")]
|
||||
public event EventHandler SelectedIndexChanged;
|
||||
@ -45,14 +51,6 @@ namespace DS4Windows.DS4Forms
|
||||
set { label1.Text = value; }
|
||||
}
|
||||
|
||||
[Category("Data")]
|
||||
[Description("If probing path has been changed in App.config, add the same string here.")]
|
||||
public string ProbingPath { get; set; } = "Lang";
|
||||
|
||||
[Category("Data")]
|
||||
[Description("Filter language assembly file names in order to ont include irrelevant assemblies to the combo box.")]
|
||||
public string LanguageAssemblyName { get; set; } = "DS4Windows.resources.dll";
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int SelectedIndex
|
||||
{
|
||||
@ -78,6 +76,19 @@ namespace DS4Windows.DS4Forms
|
||||
{
|
||||
InitializeComponent();
|
||||
cbCulture.Enabled = false;
|
||||
|
||||
Task.Run(() => {
|
||||
// Find available language assemblies and bind the list to the combo box.
|
||||
cbCulture.DataSource = CreateLanguageAssembliesBindingSource();
|
||||
cbCulture.SelectedValue = Thread.CurrentThread.CurrentUICulture.Name;
|
||||
|
||||
// This must be set here instead of Designer or event would fire at initial selected value setting above.
|
||||
cbCulture.SelectedIndexChanged += new EventHandler(CbCulture_SelectedIndexChanged);
|
||||
cbCulture.SelectedValueChanged += new EventHandler(CbCulture_SelectedValueChanged);
|
||||
|
||||
cbCulture.Enabled = true;
|
||||
LanguageListInitialized.SetResult(true);
|
||||
});
|
||||
}
|
||||
|
||||
private BindingSource CreateLanguageAssembliesBindingSource()
|
||||
@ -130,21 +141,5 @@ namespace DS4Windows.DS4Forms
|
||||
{
|
||||
SelectedValueChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private void LanguagePackComboBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
Invoke(new Action(() => {
|
||||
// Find available language assemblies and bind the list to the combo box.
|
||||
cbCulture.DataSource = CreateLanguageAssembliesBindingSource();
|
||||
cbCulture.SelectedValue = Thread.CurrentThread.CurrentUICulture.Name;
|
||||
|
||||
// This must be set here instead of Designer or event would fire at initial selected value setting above.
|
||||
cbCulture.SelectedIndexChanged += new EventHandler(CbCulture_SelectedIndexChanged);
|
||||
cbCulture.SelectedValueChanged += new EventHandler(CbCulture_SelectedValueChanged);
|
||||
|
||||
cbCulture.Enabled = true;
|
||||
LanguageListInitialized.SetResult(true);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user