Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj">2D的一个图件</param>
        /// <returns></returns>
        public IBLCompound CreatePackage(object obj)
        {
            TDCompoundPackage result = new TDCompoundPackage();
            IBLUIConfigGroup  group  = UIConfigs.GetConfigGroup("2D");

            Type type = obj.GetType();

            PropertyInfo[]      properties     = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
            object[]            tempAttributes = null;
            TDUIConfigAttribute tempAttribute  = null;
            TDPptElement        temp           = null;

            foreach (PropertyInfo one in properties)
            {
                tempAttributes = one.GetCustomAttributes(typeof(TDUIConfigAttribute), false);
                if (tempAttributes.Length <= 0)
                {
                    continue;
                }
                tempAttribute = tempAttributes[0] as TDUIConfigAttribute;
                temp          = tempAttribute.CreateTDObject(obj, one);
                if (temp == null)
                {
                    throw new Exception("没有正确生成包装对象,检查图件属性的标签是否设置错误。");
                }
                temp.UIConfig = group.GetItemConfig(tempAttribute.ConfigItemID);
                if (temp is TDPptCompoud)
                {
                    IBLUIConfig[] configs = new IBLUIConfig[tempAttribute.ChildConfigItemID.Length];
                    Int32         index   = 0;
                    foreach (Int32 id in tempAttribute.ChildConfigItemID)
                    {
                        configs[index] = group.GetItemConfig(id);
                        index++;
                    }
                    (temp as TDPptCompoud).InitChildUIConfig(configs);
                }
                result.AddChild(temp);
            }
            return(result);
        }
Exemple #2
0
 public void AddChild(TDPptElement obj)
 {
     _children.Add(obj);
 }