/// <summary> /// 检查指定的窗体元素是否存在,使用code,(在所有窗体范围内) /// </summary> /// <param name="code"></param> /// <param name="type"></param> /// <returns></returns> public bool CheckElementExistByCode(string code, UIElementEntityProvideAttribute type) { //得到所有窗体id列表,迭代,从缓存中取出XML,使用XPath进行查询 List <string> idList = GetWindowIds(); foreach (var id in idList) { XElement xml = (XElement)_cachingService.GetData(id); if (xml == null) { //这里不用再缓存了 GetWindowEntity方法就做了缓存 xml = XElement.Parse(GetWindowEntity(id).ToXml()); } if (xml.XPathSelectElement(String.Format( XPATH_Window_SelectElement_ByCode_ByControlType, code, type.Code)) == null) { continue; } else { return(true); } } return(false); }
/// <summary> /// 初始化窗体元素超连接 /// </summary> private void InitFormElementLink() { StringBuilder sbLink = new StringBuilder(); this.linkLabelFormElement.Links.Clear(); this.linkLabelFormElement.Text = String.Empty; sbLink.Append(Language.Current.FormGlobalFormElementChoose_CurrentAllowFormElementControlType); sbLink.Append(":"); if (this.AllowSelectFormElementControlType.Any) { sbLink.Append(Language.Current.FormGlobalFormElementChoose_AllowFormElementControlType_All); this.linkLabelFormElement.Links.Add(sbLink.Length - Language.Current.FormGlobalFormElementChoose_AllowFormElementControlType_All.Length, Language.Current.FormGlobalFormElementChoose_AllowFormElementControlType_All.Length, null); } else { foreach (Type type in this.AllowSelectFormElementControlType) { UIElementEntityProvideAttribute attribute = FormElementEntityDevTypes.Instance.GetProvideAttribute(type); if (attribute != null) { sbLink.Append(attribute.Name); this.linkLabelFormElement.Links.Add(sbLink.Length - attribute.Name.Length, attribute.Name.Length, type); sbLink.Append(","); } } if (sbLink.Length >= 1) { sbLink.Remove(sbLink.Length - 1, 1); } } this.linkLabelFormElement.Text = sbLink.ToString(); }
public bool CheckElementExistByCode(string code, UIElementEntityProvideAttribute type) { return(_windowArchive.CheckElementExistByCode(code, type)); }