public static XFormat CreateXFormats(XElement xe) { XFormat xf = CreateXFormat(xe); foreach (XElement xe2 in xe.Elements()) { xf.Add(xe2); } return(xf); }
public XFormat Add(XElement xe) { XFormat xf = XFormat.CreateXFormat(xe); xf.gParent = this; if (gChilds.Count > 0) { XFormat xf2 = gChilds[gChilds.Count - 1]; xf2.gNextElement = xf; xf.gPreviousElement = xf2; } gChilds.Add(xf); foreach (XElement xe2 in xe.Elements()) { xf.Add(xe2); } return(xf); }
public static XFormat CreateXFormat(XElement xe) { XFormat xf = new XFormat(); xf.gsName = xe.Name.LocalName; xf.gsFormat = xe.zAttribValue("format"); if (xf.gsFormat != null) { xf.gFormats = StringZones.SplitZone(xf.gsFormat, new char[,] { { '{', '}' } }); string sFormat = ""; int i = 0; xf.gFormatValues = new List<XValueFormat>(); foreach (StringZone format in xf.gFormats) { if (format.BeginZoneChar == '{') { sFormat += "{" + i++.ToString() + "}"; XValueFormat valueFormat = null; //{Node(Phone) - {@PhoneType} {@Phone}} StringZone[] zones = StringZones.SplitZone(format.ContentString, new char[,] { { '(', ')' }, { '{', '}' } }); if (zones.Length >= 2 && zones[0].BeginZoneChar == (char)0 && zones[1].BeginZoneChar == '(') { if (zones[0].String.ToLower() == "node") { valueFormat = new XValueFormat(); valueFormat.XPath = zones[1].ContentString; valueFormat.Values = new List<XValueFormat>(); string sFormat2 = ""; int i2 = 0; for (int j = 2; j < zones.Length; j++) { if (zones[j].BeginZoneChar == '{') { sFormat2 += "{" + i2++.ToString() + "}"; valueFormat.Values.Add(new XValueFormat() { XPath = zones[j].ContentString }); } else sFormat2 += zones[j].String; } valueFormat.Format = sFormat2; } } else valueFormat = new XValueFormat() { XPath = format.ContentString }; if (valueFormat != null) xf.gFormatValues.Add(valueFormat); } else sFormat += format.String; } xf.gsStringFormat = sFormat; } xf.SetOptions(xe.zAttribValue("option")); return xf; }
public static void TreeViewAdd(TreeNode node, XElement xeData, XFormat xFormat) { int nb = xeData.Elements().Count(); if (nb == 0) return; if (xFormat != null && xFormat.HideChild) return; if (xFormat == null || !xFormat.NoChildCount) node.Text += " (" + nb.ToString() + ")"; foreach (XElement xeChild in xeData.Elements()) { XFormat xChildFormat = null; if (xFormat != null) xChildFormat = xFormat.Element(xeChild.Name.LocalName); bool bHide = false; string s = null; if (xChildFormat != null) { if (xChildFormat.Hide) bHide = true; else if (xChildFormat.HideElementIndex != null) { int i1 = xeChild.zGetElementIndex(); foreach (int i2 in xChildFormat.HideElementIndex) { if (i1 == i2) { bHide = true; break; } } } if (!bHide) s = xChildFormat.Format(xeChild); } if (!bHide && s == null) //s = ElementToString(xeChild); s = xeChild.zToString(); if (!bHide) { TreeNode nodeChild = node.Nodes.Add(s); if (xChildFormat != null && xChildFormat.ExpandNode) nodeChild.Expand(); TreeViewAdd(nodeChild, xeChild, xChildFormat); } } }
public static void zAddNode(this TreeView tree, string nodeName, XElement xmlElement, XFormat xFormat) { TreeNode node = tree.Nodes.Add(nodeName); TreeViewAdd(node, xmlElement, xFormat); }
public static XFormat CreateXFormat(XElement xe) { XFormat xf = new XFormat(); xf.gsName = xe.Name.LocalName; xf.gsFormat = xe.zAttribValue("format"); if (xf.gsFormat != null) { xf.gFormats = StringZones.SplitZone(xf.gsFormat, new char[, ] { { '{', '}' } }); string sFormat = ""; int i = 0; xf.gFormatValues = new List <XValueFormat>(); foreach (StringZone format in xf.gFormats) { if (format.BeginZoneChar == '{') { sFormat += "{" + i++.ToString() + "}"; XValueFormat valueFormat = null; //{Node(Phone) - {@PhoneType} {@Phone}} StringZone[] zones = StringZones.SplitZone(format.ContentString, new char[, ] { { '(', ')' }, { '{', '}' } }); if (zones.Length >= 2 && zones[0].BeginZoneChar == (char)0 && zones[1].BeginZoneChar == '(') { if (zones[0].String.ToLower() == "node") { valueFormat = new XValueFormat(); valueFormat.XPath = zones[1].ContentString; valueFormat.Values = new List <XValueFormat>(); string sFormat2 = ""; int i2 = 0; for (int j = 2; j < zones.Length; j++) { if (zones[j].BeginZoneChar == '{') { sFormat2 += "{" + i2++.ToString() + "}"; valueFormat.Values.Add(new XValueFormat() { XPath = zones[j].ContentString }); } else { sFormat2 += zones[j].String; } } valueFormat.Format = sFormat2; } } else { valueFormat = new XValueFormat() { XPath = format.ContentString } }; if (valueFormat != null) { xf.gFormatValues.Add(valueFormat); } } else { sFormat += format.String; } } xf.gsStringFormat = sFormat; } xf.SetOptions(xe.zAttribValue("option")); return(xf); }
private void EventTreeViewResultAdd(string nodeName, XElement xmlElement, XFormat format) { if (InvokeRequired) { EventTreeViewResultAddCallback callback = new EventTreeViewResultAddCallback(EventTreeViewResultAdd); Invoke(callback, nodeName, xmlElement, format); } //else //{ // //tree_result.SuspendLayout(); // //tree_result.zAddNode(nodeName, xmlElement, format); // _treeViewResult = true; //} }
private static void EventTreeViewResultAdd(string nodeName, XElement xmlElement, XFormat xFormat) { }