LocalizationDemo/MainWindow.xaml.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using System.Globalization;
using System.Windows.Controls;
using System.Threading;
using System.Linq;

namespace LocalizationDemo
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            InitData(20);
        }
        private void InitData(int empCount)
        {
            List<Employee> empList = new List<Employee>();
            for (int i = 0; i < empCount; i++)
            {
                empList.Add(new Employee
                {
                    No = string.Format("ID{0}", i),
                    Name = string.Format("Name{0}", i),
                    Gender = i % 3 == 0 ? "Famale" : "Male",
                    Dept = string.Format("Dept{0}", i % 5),
                    Email = string.Format("Name{0}_{1}@mail.com", string.Format("Name{0}", i), string.Format("Dept{0}", i % 5)),
                    Tel = string.Format("0101234{0}", i)
                });
            }
            dgempList.ItemsSource = empList;
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Application.Current.TryFindResource("MsgShowTime").ToString(), DateTime.Now.ToString()));
        }
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;
            if (mi.Name.Equals("hdChinese"))
            {
                App.Culture = "zh-CN";
            }
            else
            {
                App.Culture = "en-US";
            }
            //update culture
            App.UpdateCulture();
            MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Application.Current.TryFindResource("MsgSuccess").ToString()));
        }
    }
    public class Employee
后面还有 9 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。