コード例 #1
0
        private void OnKeyChanged(PropertyItem item, string lastKey, string key)
        {
            if (!string.IsNullOrEmpty(lastKey) && propertyDic.ContainsKey(lastKey))
            {
                if (!string.IsNullOrEmpty(propertyDic[lastKey]))
                {
                    propertyCatchedDic[lastKey] = propertyDic[lastKey];
                }
                propertyDic.Remove(lastKey);
            }

            if (!string.IsNullOrEmpty(key))
            {
                if (propertyDic.ContainsKey(key))//不支持重复
                {
                    OnDeleteItem(item);
                }
                else
                {
                    if (propertyCatchedDic.ContainsKey(key))//从缓存加载
                    {
                        propertyDic[key] = propertyCatchedDic[key];
                    }
                    else
                    {
                        propertyDic.Add(key, "");
                    }

                    item.UpdateInfo(key, propertyDic[key]);
                }
                SetAcitveKey(propertyDic, key);
            }
        }
コード例 #2
0
        public static string GetString(string key, string culture)
        {
            var str = key;

            if (ResourceDic.ContainsKey(key))
            {
                str = culture == "en" ? ResourceDic[key].English : ResourceDic[key].French;
            }
            return(str);
        }