/// <summary> /// 构造函数 /// </summary> /// <param name="name"></param> /// <param name="itembox"></param> /// <param name="enumDatas"></param> public ParatItem(string name, ParaItemEnum pie, List <string> enumDatas = null) { this.Id = Tools.CreateId(); this.Name = name; this.EnumDatas = enumDatas; this.PIEnum = pie; }
/// <summary> /// 创建一个属性,如果存在则只修改值 /// </summary> /// <param name="value"></param> /// <param name="type"></param> /// <param name="name"></param> public void CreateProperty(object value, ParaItemEnum type, string name, bool isaddtoIPropertys = false) { if (IPropertys.Where(p => p.Name == name).Count() == 0) { IPropertys.Add(new PropertyIt() { Name = name, PIEnum = type, Value = value, }); if (isaddtoIPropertys) { scriptContent.Add(IPropertys.Last()); } if (name == "TaskPhones") { IPropertys.Last().Id = Guid.Empty.ToString(); } } else { IPropertyIt ipi = IPropertys.Where(p => p.Name == name).First(); ipi.Value = value; } }
/// <summary> /// 获取类型相对的控件 /// </summary> /// <param name="penum"></param> /// <returns></returns> public IReflexui GetControlType(ParaItemEnum penum) { if (this.typeDictionary.ContainsKey(penum)) { return(Activator.CreateInstance(this.typeDictionary[penum].GetType()) as IReflexui); } else { return(null); } }
/// <summary> /// 添加一个类型和控件的映射 /// </summary> /// <param name="penum"></param> /// <param name="iref"></param> public void SetType(ParaItemEnum penum, IReflexui iref) { if (iref as Control == null) { throw new Exception("添加的控件类型异常,请继承Cntrol, 并且实现IReflexui方法"); } if (this.typeDictionary.ContainsKey(penum)) { this.typeDictionary[penum] = null; this.typeDictionary[penum] = iref; } else { this.typeDictionary.Add(penum, iref); } }