|
using System.Threading;
using System.Windows.Controls;
using SchoolSample.Common;
namespace SchoolSample
{
/// <summary>
/// Interaction logic for Home.xaml
/// </summary>
public partial class Home
{
public Home()
{
InitializeComponent();
CultureSelection.SelectedIndex = 0;
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
foreach (ComboBoxItem item in e.AddedItems)
{
switch (item.Content.ToString())
{
case "English":
AppMessages.CultureChangeMessage.Send("en");
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en");
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
break;
case "中文(简体)":
AppMessages.CultureChangeMessage.Send("zh-Hans");
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-Hans");
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans");
break;
case "中文(繁體)":
AppMessages.CultureChangeMessage.Send("zh-Hant");
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-Hant");
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hant");
break;
}
((ApplicationResources)(App.Current.Resources["ApplicationResources"])).OnCultureChanged();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET