/// <summary> /// 遍历指定的页面的所有指定的控件 /// </summary> /// <param name="parent"></param> /// <param name="type"></param> /// <returns></returns> public List <UIElement> GetChild(DependencyObject parent, EnumElementType type) { var resp = new List <UIElement>(); try { var numVisuals = VisualTreeHelper.GetChildrenCount(parent); for (int i = 0; i < numVisuals; i++) { var v = (DependencyObject)VisualTreeHelper.GetChild(parent, i); var child = GetUIElement(v, type); if (child != null) { resp.Add(child); } if (child == null) { var item = GetChild(v, type); if ((item?.Count ?? 0) > 0) { resp.AddRange(item); } } } } catch { } return(resp); }
private UIElement GetUIElement(DependencyObject dObject, EnumElementType type) { try { switch (type) { case EnumElementType.TextBox: return(dObject as TextBox); case EnumElementType.RadioButton: return(dObject as RadioButton); case EnumElementType.ComboBox: return(dObject as ComboBox); case EnumElementType.CheckBox: return(dObject as CheckBox); case EnumElementType.ButtonEx: return(dObject as ButtonEx); default: throw new ArgumentException("不支持的类型"); } } catch { return(null); } }
public ICard ConvertToCard() { EnumElementType elementType = EnumElementType.Normal; if (Regex.IsMatch(Name, "Fire.*")) { elementType = EnumElementType.Fire; } if (Regex.IsMatch(Name, "Water.*")) { elementType = EnumElementType.Water; } if (Regex.IsMatch(Name, ".*Goblin")) { return(new Goblin(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Ork")) { return(new Orc(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Dragon")) { return(new Dragon(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Knight")) { return(new Knight(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Wizard")) { return(new Wizard(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Elf")) { return(new Fireelf(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Kraken")) { return(new Kraken(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Bug")) { return(new Bug(Id, Name, Damage, elementType)); } if (Regex.IsMatch(Name, ".*Spell")) { return(new SpellCard(Id, Name, Damage, elementType)); } return(null); }
public MonsterCard(string name, double damage, EnumElementType element) { Name = name; Damage = damage; switch (element) { case EnumElementType.Normal: Element = new Normal(); break; case EnumElementType.Fire: Element = new Fire(); break; case EnumElementType.Water: Element = new Water(); break; default: Element = new Normal(); break; } }
public Bug(string id, string name, double damage, EnumElementType element) : base(id, name, damage, element) { }
public Fireelf(string name, double damage, EnumElementType element) : base(name, damage, element) { }
public Goblin(string name, double damage, EnumElementType element) : base(name, damage, element) { }
/// /// <summary> * (9) get attribute ElementType </summary> /// * <returns> the value of the attribute </returns> /// public virtual EnumElementType getElementType() { return(EnumElementType.getEnum(getAttribute(AttributeName.ELEMENTTYPE, null, null))); }
// --------------------------------------------------------------------- // Methods for Attribute ElementType // --------------------------------------------------------------------- /// /// <summary> * (5) set attribute ElementType </summary> /// * <param name="enumVar">: the enumVar to set the attribute to </param> /// public virtual void setElementType(EnumElementType enumVar) { setAttribute(AttributeName.ELEMENTTYPE, enumVar == null ? null : enumVar.getName(), null); }
static JDFAutoLayoutElement() { atrInfoTable[0] = new AtrInfoTable(AttributeName.IGNOREPDLCOPIES, 0x33333331, AttributeInfo.EnumAttributeType.boolean_, null, "false"); atrInfoTable[1] = new AtrInfoTable(AttributeName.IGNOREPDLIMPOSITION, 0x33333331, AttributeInfo.EnumAttributeType.boolean_, null, "true"); atrInfoTable[2] = new AtrInfoTable(AttributeName.CLIPPATH, 0x33333333, AttributeInfo.EnumAttributeType.PDFPath, null, null); atrInfoTable[3] = new AtrInfoTable(AttributeName.ELEMENTTYPE, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumElementType.getEnum(0), null); atrInfoTable[4] = new AtrInfoTable(AttributeName.HASBLEEDS, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, null); atrInfoTable[5] = new AtrInfoTable(AttributeName.ISBLANK, 0x33333311, AttributeInfo.EnumAttributeType.boolean_, null, null); atrInfoTable[6] = new AtrInfoTable(AttributeName.ISPRINTABLE, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, null); atrInfoTable[7] = new AtrInfoTable(AttributeName.ISTRAPPED, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, null); atrInfoTable[8] = new AtrInfoTable(AttributeName.PAGELISTINDEX, 0x33333311, AttributeInfo.EnumAttributeType.IntegerRangeList, null, null); atrInfoTable[9] = new AtrInfoTable(AttributeName.SOURCEBLEEDBOX, 0x33333333, AttributeInfo.EnumAttributeType.rectangle, null, null); atrInfoTable[10] = new AtrInfoTable(AttributeName.SOURCECLIPBOX, 0x33333333, AttributeInfo.EnumAttributeType.rectangle, null, null); atrInfoTable[11] = new AtrInfoTable(AttributeName.SOURCETRIMBOX, 0x33333333, AttributeInfo.EnumAttributeType.rectangle, null, null); atrInfoTable[12] = new AtrInfoTable(AttributeName.TEMPLATE, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, null); elemInfoTable[0] = new ElemInfoTable(ElementName.COLORPOOL, 0x66666611); elemInfoTable[1] = new ElemInfoTable(ElementName.DEPENDENCIES, 0x66666611); elemInfoTable[2] = new ElemInfoTable(ElementName.ELEMENTCOLORPARAMS, 0x66666611); elemInfoTable[3] = new ElemInfoTable(ElementName.FILESPEC, 0x66666666); elemInfoTable[4] = new ElemInfoTable(ElementName.IMAGECOMPRESSIONPARAMS, 0x66666611); elemInfoTable[5] = new ElemInfoTable(ElementName.PAGELIST, 0x66666611); elemInfoTable[6] = new ElemInfoTable(ElementName.SCREENINGPARAMS, 0x66666611); elemInfoTable[7] = new ElemInfoTable(ElementName.SEPARATIONSPEC, 0x33333333); }
public Knight(string name, double damage, EnumElementType element) : base(name, damage, element) { }
public Wizard(string name, double damage, EnumElementType element) : base(name, damage, element) { }