Пример #1
0
 public GTextBox(PropertyInfo pinfo, object value)
 {
     InitializeComponent();
     Attribute    = GongFaManager.GetGongFaAttribute(pinfo);
     info         = pinfo;
     orginalValue = value;
 }
Пример #2
0
        /// <summary>
        /// 加载功法数据
        /// </summary>
        /// <param name="gongfaIndex"></param>
        public void ShowGongFaData(int gongfaIndex)
        {
            var gongfa = gongFaManager.GongFaList.FirstOrDefault(t => t.GongFaId == gongfaIndex);
            var list   = new List <GTextBox>();

            Parallel.ForEach(gongfa.GetType().GetProperties(), (prop) =>
            {
                var attr = GongFaManager.GetGongFaAttribute(prop);
                if (attr != null)
                {
                    if (attr.Skip)
                    {
                        return;
                    }
                    var gtb = new GTextBox(prop, prop.GetValue(gongfa));
                    gtb.Init();
                    gtb.ValueChanged += (sender, e) =>
                    {
                        prop.SetValue(gongfa, e.ChangedValue);
                        gongfa.Original[attr.Index] = e.ChangedValue.ToString();
                    };
                    list.Add(gtb);
                }
            });
            flowLayoutPanel1.Controls.AddRange(list.ToArray());
        }