private void ChildNotifyIsChecked(bool?oldValue, bool?newValue) { if (oldValue == false) { CheckedCount++; } else if (oldValue == null) { if (newValue == false) { CheckedCount--; } _nullCount--; } else { if (newValue == false) { CheckedCount--; } } if (newValue == null) { _nullCount++; } bool?value = _nullCount == 0 ? (_CheckedCount == 0 ? false : _CheckedCount == base.Children.Count ? true : (bool?)null) : null; if (_IsChecked != value) { RuleCompareNode node = base.Parent as RuleCompareNode; if (node != null) { node.ChildNotifyIsChecked(_IsChecked, value); } _IsChecked = value; OnPropertyChanged(IsCheckedChanged); } }
/// <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); }