Merge branch 'language-switch-propery-fix' of https://github.com/czukowski/DS4Windows into czukowski-language-switch-propery-fix

This commit is contained in:
Travis Nickles 2018-02-10 13:41:43 -06:00
commit a9c165d058
2 changed files with 17 additions and 13 deletions

View File

@ -55,6 +55,7 @@
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);

View File

@ -78,19 +78,6 @@ 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()
@ -143,5 +130,21 @@ 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);
}));
}
}
}