public XmlScenarioTable() : base() { _rows = new XmlScenarioRows(this); this.E_CellClicked += new CellClickEventHandler(XmlScenarioTable_E_CellClicked); this.E_TextChanged += new CellTextChangedEventHandler(XmlScenarioTable_E_TextChanged); this.E_CheckBoxChanged += new CellCheckedEventHandler(XmlScenarioTable_E_CheckBoxChanged); this.E_CheckBoxGroupSelected += new CellCheckBoxGroupSelectedEventHandler(XmlScenarioTable_E_CheckBoxGroupSelected); this.E_CellRightClicked += new CellClickEventHandler(XmlScenarioTable_E_CellRightClicked); this.E_CellDoubleClicked += new CellClickEventHandler(XmlScenarioTable_E_CellDoubleClicked); this.E_ContextMenuClicked += new EasyGridMenuClickHandler(XmlScenarioTable_E_ContextMenuClicked); }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, bool refLoad = false) { if (rootNode == null) { return; } XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this, refLoad, Args, GetComponentValue); XmlNode xNode = XmlGetter.Child(rootNode, "TableInfo/BaseRowHeight"); if (xNode != null) { this.BaseRowHeight = int.Parse(xNode.InnerText); } #region getTableColumn XmlNodeList xNodeList = XmlGetter.Children(rootNode, "Columns/Column"); for (int i = 0; i < xNodeList.Count; i++) { XmlNode colNode = xNodeList[i]; if (colNode.NodeType == XmlNodeType.Comment) { continue; } int wid = int.Parse(XmlGetter.Attribute(colNode, "Width")); String name = XmlGetter.Attribute(colNode, "Name"); ItemTypes itemType = (ItemTypes)(ItemTypesText.ToList().IndexOf(XmlGetter.Attribute(colNode, "ItemType"))); XmlNodeList colItems = colNode.ChildNodes; Actions onClickAction = Actions.Auto; Actions onDoubleClickAction = Actions.Auto; Actions onRightClickAction = Actions.Auto; XmlNode properties = null; for (int ci = 0; ci < colItems.Count; ci++) { if (colItems[ci].NodeType == XmlNodeType.Comment) { continue; } if (colItems[ci].Name.Equals("Actions")) { XmlNodeList xActions = colItems[ci].ChildNodes; for (int ai = 0; ai < xActions.Count; ai++) { if (xActions[ai].NodeType == XmlNodeType.Comment) { continue; } switch (xActions[ai].Name) { case "OnClick": onClickAction = (Actions)(ActionsText.ToList().IndexOf(xActions[ai].InnerText)); break; case "OnDoubleClick": onDoubleClickAction = (Actions)(ActionsText.ToList().IndexOf(xActions[ai].InnerText)); break; case "OnRightClick": onRightClickAction = (Actions)(ActionsText.ToList().IndexOf(xActions[ai].InnerText)); break; } } } else { properties = colItems[ci]; } } MakeAColumn(wid, itemType, name, properties, onClickAction, onDoubleClickAction, onRightClickAction); } #endregion #region getRows XmlNode xRows = XmlGetter.Child(rootNode, "Rows"); if (xRows != null && xRows.ChildNodes.Count > 0) { _rows = new XmlScenarioRows(this); Rows.LoadXml(xDoc, xRows); } else { _rows = new XmlScenarioRows(this, xDoc, rootNode); } //xNodeList = XmlGetter.Children(rootNode,"Rows/Row"); #endregion }