/// <summary> /// 获取指定站点的可用车辆类型。 /// </summary> /// <param name="fillType">站点。</param> /// <returns></returns> public static TreeModel GetCarTypeList(string fillType) { TreeModel result = new TreeModel(); RuleCompareNode ruleNode = new RuleCompareNode() { Header = fillType, IsExpanded = true }; result.AddChild(ruleNode); XmlNodeList nodeList = doc.SelectNodes(string.Format("//Sites/Site[@Name=\"{0}\"]/Standard", fillType)); if (nodeList == null) { return(result); } foreach (XmlNode item in nodeList) { RuleCompareNode child = new RuleCompareNode(); XmlAttribute attr = item.Attributes["Name"]; child.Header = attr == null ? "" : attr.Value; attr = item.Attributes["Value"]; child.Content = attr == null ? null : attr.Value; ruleNode.AddChild(child); foreach (XmlNode childItem in item.ChildNodes) { XmlText text = childItem.FirstChild as XmlText; if (text != null) { RuleCompareNode textNode = new RuleCompareNode(); textNode.Header = text.Value; child.AddChild(textNode); } } } return(result); }
private void CompareWorker(object state) { try { TreeModel result = new TreeModel(); string type = _root.Header; RuleCompareNode root = new RuleCompareNode() { Header = _root.Header, IsExpanded = true }; result.AddChild(root); RuleCompareNode resultItem; string path = state as string; if (type == "国环") { _asyncHandler = new FillAsyncHandler(); List <KeyValuePair <string, string> > appendixes = FileHelper.GetAppendixes(type); foreach (RuleCompareNode item in _root.Children) { if (item.IsChecked == false) { continue; } // 排放标准 resultItem = new RuleCompareNode() { Header = item.Header }; root.AddChild(resultItem); foreach (var appendix in appendixes) { RuleCompareNode appendixNode = new RuleCompareNode() { Header = appendix.Key }; resultItem.AddChild(appendixNode); CompareInner(item, appendixNode, path, type, appendix); } } } else if (type == "北环") { _asyncHandler = new FillAsyncHandler(); foreach (RuleCompareNode item in _root.Children) { if (item.IsChecked == false) { continue; } // 排放标准 resultItem = new RuleCompareNode() { Header = item.Header }; root.AddChild(resultItem); CompareInner(item, resultItem, path, type, null); } } this.Result = result; this.fillManager.EndFill(); OnFinished(EventArgs.Empty); this.fillManager = null; } catch (Exception ex) { WebFillManager.ShowMessageBox(ex.Message, "错误", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } finally { if (this.fillManager != null) { this.fillManager.EndFill(); this.fillManager = null; } } }