When my application run with a specified culture. Don't close the application, user changes system's culture, ex: change number decimal separator from "." to ",". How to my application can catch this event. Thanks.
Notes: C# 2.0, Windows Form.
When my application run with a specified culture. Don't close the application, user changes system's culture, ex: change number decimal separator from "." to ",". How to my application can catch this event. Thanks.
Notes: C# 2.0, Windows Form.
You can handle the SystemEvents.UserPreferenceChanged
event:
void SystemEvents.UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
// Regional settings have changed
if (e.Category == UserPreferenceCategory.Locale)
{
...
}
}
If you want to trach system language changes then you have SystemEvents object which contains UserPreferenceChanged event you can attach to.
Sample:
Microsoft.Win32.SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
If you want to track input language changes (like changes in system try when you choose between languages), then you can use: System.Windows.Forms.InputLanguage.CurrentInputLanguage
Sample:
string inputLanguage = System.Windows.Forms.InputLanguage.CurrentInputLanguage.LayoutName;
© 2022 - 2024 — McMap. All rights reserved.