private void init(Control container) { mType = typeof(T); TAG = mType.Name; PropertyInfo[] mPropertyInfo = typeof(T).GetProperties(); List <AgcBase> attachList = new List <AgcBase>(); try { mAgcSetting = (Attribute.GetCustomAttribute(mType, typeof(AgcSetting)) as AgcSetting); } catch (Exception) { mAgcSetting = new AgcSetting(); } foreach (PropertyInfo pi in mPropertyInfo) { try { Attribute attr = Attribute.GetCustomAttribute(pi, typeof(AgcBase)); if (attr != null) { AgcBase ab = (attr as AgcBase); if (ab.isAttach) { attachList.Add(ab); } else { baseList.Add(ab); } propDic[pi.Name] = ab; } } catch (System.Exception ex) { throw new Exception(String.Format("{0} 获取控件配置出错:", mType) + ex.Message); } } if (attachList.Count > 0) { foreach (AgcBase var in attachList) { try { (getControl(var.attachProp) as IAgcAttach).attach(var); } catch (Exception e) { throw new Exception(String.Format("{0}: {1} 附加的属性名对应的控件未实现接口AGC.interfaces.IAgcAttach" + e.Message, TAG, var.Title)); } } } mContainer = container; mGanerator = new AgcGanerator(mContainer, mAgcSetting); }
public void attach(AgcBase agcBase) { attachList.Add(agcBase); foreach (AgcControl ac in agcBase.MAgcCtlList) { this.MAgcCtlList.Add(ac); } }
public void attach(AgcBase agcBase) { mAttachList.Add(agcBase); }
void IAgcAttach.attach(AgcBase agcBase) { mAttachList.Add(agcBase); }