mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Load settings from Global sooner, set culture from settings, add event handler for language picker change
This commit is contained in:
parent
f0b645b7e5
commit
a794d2c718
@ -88,6 +88,9 @@ namespace DS4Windows
|
||||
|
||||
public DS4Form(string[] args)
|
||||
{
|
||||
Global.Load();
|
||||
Program.SetCulture(UseLang);
|
||||
|
||||
InitializeComponent();
|
||||
ThemeUtil.SetTheme(lvDebug);
|
||||
|
||||
@ -181,7 +184,6 @@ namespace DS4Windows
|
||||
Log.TrayIconLog += ShowNotification;
|
||||
|
||||
Directory.CreateDirectory(appdatapath);
|
||||
Global.Load();
|
||||
if (!Save()) //if can't write to file
|
||||
{
|
||||
if (MessageBox.Show("Cannot write at current location\nCopy Settings to appdata?", "DS4Windows",
|
||||
@ -2487,6 +2489,13 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
private void languagePackComboBox1_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
UseLang = ((DS4Forms.LanguagePackComboBox)sender).SelectedValue.ToString();
|
||||
Save();
|
||||
MessageBox.Show("DS4Windows must be restarted in order to have an effect.");
|
||||
}
|
||||
|
||||
private void cBFlashWhenLate_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
FlashWhenLate = cBFlashWhenLate.Checked;
|
||||
|
@ -120,6 +120,18 @@ namespace DS4Windows
|
||||
threadComEvent.Close();
|
||||
}
|
||||
|
||||
public static void SetCulture(string culture)
|
||||
{
|
||||
foreach (Thread t in new Thread[] { Thread.CurrentThread, controlThread })
|
||||
{
|
||||
if (t != null && !t.CurrentUICulture.Equals(culture))
|
||||
{
|
||||
try { t.CurrentUICulture = CultureInfo.GetCultureInfo(culture); }
|
||||
catch { /* Skip setting culture that we cannot set */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createControlService()
|
||||
{
|
||||
controlThread = new Thread(() => { rootHub = new ControlService(); });
|
||||
|
Loading…
Reference in New Issue
Block a user