1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| treeList1.BeginUpdate();
DataTable dt = new DataTable(); dt.Columns.Add("name", typeof(string)); dt.Columns.Add("pid", typeof(int)); dt.Columns.Add("imgid", typeof(int));
XDocument xDocument = XDocument.Load(Application.StartupPath + "\\SymbolizationConfig.xml"); XElement mapxEle = null; XElement mapEle = null; IEnumerable<XElement> enumerable = xDocument.Root.Elements(); foreach (var item in enumerable) { if (comboBoxEdit_Mapx.Text.Equals(item.Attribute("meaning").Value)) { mapxEle = item; break; } } enumerable = mapxEle.Elements(); foreach (var item in enumerable) { if (comboBoxEdit_Map.Text.Equals(item.Attribute("meaning").Value)) { mapEle = item; break; } } enumerable = mapEle.Elements(); foreach (var item in enumerable) { List<string> typeLst = new List<string>() { "PNT", "LIN", "ARE", "ANN" }; string name = item.Attribute("name").Value; string type = item.Attribute("sfclstype").Value; int imgidx = typeLst.IndexOf(type);
DataRow dr = dt.NewRow(); dr["name"] = name; dr["pid"] = -1; dr["imgid"] = imgidx; dt.Rows.Add(dr); }
treeList1.DataSource = dt; treeList1.EndUpdate();
|