带有一些信息的简单表格。一下拉选择语言,如下所示:
<controls:LanguageControl Width="155" HorizontalAlignment="Left" Margin="0,0,0,5" SelectedCultureInfo="{Binding CurrentLanguage,Mode=TwoWay}"></controls:LanguageControl>
private CultureInfo _lang;
public CultureInfo CurrentLanguage
{
set
{
_lang = value;
if (!System.Threading.Thread.CurrentThread.CurrentUICulture.Equals(_lang))
{
System.Threading.Thread.CurrentThread.CurrentUICulture = _lang;
AppSettings.SetValue(SettingsKeys.LANGUAGE, _lang.LCID);
System.Threading.Thread.CurrentThread.CurrentUICulture = value;
WPFCommon.Localization.LocalizeDictionary.Instance.Culture = value;
Rhino.Main.Properties.Resources.Culture = value;
OnPropertyChanged("CurrentLanguage");
}
}
get
{
if (_lang == null)
{
_lang = new CultureInfo(Convert.ToInt32(AppSettings.GetValue(SettingsKeys.LANGUAGE)));
}
return _lang;
}
}
当我重新启动应用程序时,所有文本都被所选语言替换。
但是如果不重新启动应用程序,我将如何立即执行?