public RowBool(DataAttr attrDef, string name = "", string value = "", AttrList parent = null) { InitializeComponent(); m_parent = parent; m_isCommon = attrDef.m_isCommon; m_subType = attrDef.m_subType; m_eventLock = false; m_name = name; m_preValue = value; m_type = attrDef.m_type; m_defValue = attrDef.m_defValue; if (m_subType != null && m_subType != "") { switch (m_subType) { case "allBool": { mx_root.MinWidth = 300; } break; default: { } break; } } }
public bool tryGetAttrDef(string attrName, out DataAttr attrDef) { attrDef = null; if(attrName != null && attrName != "") { foreach(KeyValuePair<string, DataAttrGroup> pairGroup in m_mapDataAttrGroup.ToList()) { if(pairGroup.Value.m_mapDataAttr.TryGetValue(attrName, out attrDef)) { return true; } } } return false; }
public RowNormal(DataAttr attrDef = null, string name = "", string value = "", AttrList parent = null) { InitializeComponent(); m_parent = parent; if (attrDef != null) { m_isCommon = attrDef.m_isCommon; m_subType = attrDef.m_subType; mt_type = attrDef.m_type; } else { m_isCommon = false; m_subType = ""; mt_type = "string"; } m_eventLock = false; m_name = name; m_preValue = value; m_type = mt_type; if (m_subType != null && m_subType != "") { switch (m_subType) { case "halfNormal": { mx_c2.Width = new GridLength(75); this.MinWidth = 150; mx_root.MinWidth = 150; } break; default: { } break; } } if(m_type == "Color") { mx_viewColor = new CustomWPFColorPicker.ColorPickerControlView(); mx_exFrame.Children.Add(mx_viewColor); } }
public RowEnum(DataAttr attrDef, string name = "", string value = "", AttrList parent = null) { m_isUseEvent = false; InitializeComponent(); m_parent = parent; m_mapEnum = attrDef.m_mapEnum; m_isCommon = attrDef.m_isCommon; m_subType = attrDef.m_subType; m_eventLock = false; m_name = name; m_preValue = value; m_type = attrDef.m_type; if (m_mapEnum != null && m_mapEnum.Count() > 0) { foreach (KeyValuePair<string, ComboBoxItem> pairEnum in m_mapEnum.ToList()) { ComboBoxItem cbEnum = new ComboBoxItem(); string strEnum = ""; if (m_subType != null && m_subType != "") { strEnum = MainWindow.s_pW.m_strDic.getWordByKey(pairEnum.Key, StringDic.conf_ctrlAttrTipDic + "_" + m_subType); } if (strEnum == "") { strEnum = pairEnum.Key; } cbEnum.Content = strEnum; cbEnum.ToolTip = pairEnum.Key; m_mapEnum[pairEnum.Key] = cbEnum; mx_valueEnum.Items.Add(cbEnum); } } }
public RowWeight(DataAttr attrDef, string name = "", string value = "", AttrList parent = null) { m_mapRow = new Dictionary<string, CheckBox>(); m_mapRowGroup = new Dictionary<string, Dictionary<string, RadioButton>>(); m_mapRbGroupName = new Dictionary<RadioButton, string>(); m_mapGroupTakeBack = new Dictionary<string, int>(); InitializeComponent(); m_parent = parent; m_lstWeight = attrDef.m_lstWeight; m_isCommon = attrDef.m_isCommon; m_subType = attrDef.m_subType; m_eventLock = false; if (m_lstWeight != null && m_lstWeight.Count > 0) { foreach (object rowWt in m_lstWeight) { if (rowWt != null) { if (rowWt is string) { string rowName = (string)rowWt; CheckBox cbRow = new CheckBox(); string strRow = ""; if (m_subType != null && m_subType != "") { strRow = MainWindow.s_pW.m_strDic.getWordByKey(rowName, StringDic.conf_ctrlAttrTipDic + "_" + m_subType); } if (strRow == "") { strRow = rowName; } cbRow.Content = strRow; cbRow.ToolTip = rowName; cbRow.Margin = new Thickness(5); cbRow.IsChecked = false; cbRow.Checked += mx_cbRow_Checked; cbRow.Unchecked += mx_cbRow_Unchecked; mx_valueFrame.Children.Add(cbRow); m_mapRow.Add(rowName, cbRow); } else if (rowWt is WeightRowGroup_T) { WeightRowGroup_T wrgDef = (WeightRowGroup_T)rowWt; WrapPanel wpGroup = new WrapPanel(); Label lbTitle = new Label(); string strGroup = ""; Dictionary<string, RadioButton> mapRow = new Dictionary<string, RadioButton>(); if (m_subType != null && m_subType != "") { strGroup = MainWindow.s_pW.m_strDic.getWordByKey(wrgDef.m_groupName, StringDic.conf_ctrlAttrTipDic + "_" + m_subType); } if (strGroup == "") { strGroup = wrgDef.m_groupName; } lbTitle.Content = strGroup; lbTitle.ToolTip = wrgDef.m_groupName; wpGroup.Children.Add(lbTitle); wpGroup.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0x88, 0x00, 0x00, 0x00)); mx_valueFrame.Children.Add(wpGroup); int numTakeBack = 0; foreach (string rowName in wrgDef.m_lstRow) { RadioButton rbRow = new RadioButton(); string strRow = ""; if (m_subType != null && m_subType != "") { strRow = MainWindow.s_pW.m_strDic.getWordByKey(rowName, StringDic.conf_ctrlAttrTipDic + "_" + m_subType); } if (strRow == "") { strRow = rowName; } rbRow.Content = strRow; rbRow.ToolTip = rowName; rbRow.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; rbRow.Checked += mx_rbRow_Checked; rbRow.Margin = new Thickness(1); rbRow.Padding = new Thickness(5); wpGroup.Children.Add(rbRow); mapRow.Add(rowName, rbRow); m_mapRbGroupName.Add(rbRow, wrgDef.m_groupName); int subNum; if(int.TryParse(rowName, out subNum)) { numTakeBack |= subNum; } } m_mapRowGroup.Add(wrgDef.m_groupName, mapRow); m_mapGroupTakeBack.Add(wrgDef.m_groupName, numTakeBack); } } } } m_name = name; m_preValue = value; m_type = attrDef.m_type; }
public bool parseClassData(XmlElement xeAttrClass) { if (xeAttrClass != null) { m_className = xeAttrClass.GetAttribute("key"); if(m_className == "") { return false; } foreach (XmlNode xnAttrDef in xeAttrClass.SelectNodes("attrDef")) { if (xnAttrDef is XmlElement) { XmlElement xeAttr = (XmlElement)xnAttrDef; DataAttr attrDef = new DataAttr(this); if (xeAttr.GetAttribute("type") != "") { attrDef.m_type = xeAttr.GetAttribute("type"); if (xeAttr.GetAttribute("type") == "weight") { attrDef.m_lstWeight = new ArrayList(); foreach (XmlNode xnWt in xeAttr.ChildNodes) { if (xnWt is XmlElement) { switch (xnWt.Name) { case "rowGroup": { WeightRowGroup_T wtGroup = new WeightRowGroup_T(((XmlElement)xnWt).GetAttribute("key")); attrDef.m_lstWeight.Add(wtGroup); foreach (XmlNode xnRow in xnWt.ChildNodes) { if (xnRow is XmlElement && xnRow.Name == "row") { wtGroup.m_lstRow.Add(xnRow.InnerText); } } } break; case "row": { attrDef.m_lstWeight.Add(xnWt.InnerText); } break; default: break; } } } } } else { attrDef.m_type = "string"; } if (xeAttr.GetAttribute("isEnum") == "true") { attrDef.m_isEnum = true; attrDef.m_mapEnum = new Dictionary<string, ComboBoxItem>(); foreach (XmlNode xnEnum in xeAttr.ChildNodes) { if (xnEnum.NodeType == XmlNodeType.Element) { XmlElement xeEnum = (XmlElement)xnEnum; if (xeEnum.Name == "row") { attrDef.m_mapEnum.Add(xeEnum.InnerText, null); } } } } else { attrDef.m_isEnum = false; } if (xeAttr.GetAttribute("isCommon") == "true") { attrDef.m_isCommon = true; } else { attrDef.m_isCommon = false; } attrDef.m_subType = xeAttr.GetAttribute("subType"); attrDef.m_defValue = xeAttr.GetAttribute("defValue"); string keyName = xeAttr.GetAttribute("key"); if(keyName != "") { m_mapDataAttr.Add(keyName, attrDef); } } } } return true; }