Пример #1
0
        /// <summary>
        /// 更换使用语言,将配置文件中的语言反射到UI组件上
        /// </summary>
        /// <param name="section"></param>
        public void ChangeLanguage(INISection section)
        {
            if (reflections == null)
            {
                return;
            }
            var all = reflections.All;

            for (int i = 0; i < all.Length; i++)
            {
                HText txt = all[i].Value as HText;
                if (txt != null)
                {
                    var str = section.GetValue(all[i].name);
                    if (str != null)
                    {
                        if (str != "")
                        {
                            txt.Text = str.Replace("\\n", "\n");
                        }
                        else
                        {
                            txt.Text = str;
                        }
                    }
                }
                else
                {
                    InputBox box = all[i].Value as InputBox;
                    if (box != null)
                    {
                        var str = section.GetValue(all[i].name);
                        if (str != null)
                        {
                            if (str != "")
                            {
                                box.TipString = str.Replace("\\n", "\n");
                            }
                            else
                            {
                                box.TipString = str;
                            }
                        }
                    }
                }
            }
        }