using System.Globalization;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using C1.Silverlight;

namespace WindowLocalization
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            //
            // The supported languages should be added manually 
            // to the csproj file:
            //
            // <SupportedCultures>en,es,de</SupportedCultures>
            //
            cmbLanguages.ItemsSource = new CultureInfo[] 
            {
                new CultureInfo("en"),
                new CultureInfo("es"),
                new CultureInfo("de"),
            };
            cmbLanguages.SelectionChanged += (s, e) =>
            {
                Thread.CurrentThread.CurrentUICulture = e.AddedItems[0] as CultureInfo;
            };
            cmbLanguages.SelectedIndex = 0;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            C1MessageBox.Show("", "", C1.Silverlight.C1MessageBoxButton.YesNoCancel);
        }

    }
}
