public static List <TreeNodeVM> GetAllSubTreeNodeVM(TreeNodeVM node) { if (node.NodeObj is ParentTestStep) { List <TreeNodeVM> nodeList = new List <TreeNodeVM>(); foreach (var subNode in node.SubTreeNodeList) { var subNodes = GetAllSubTreeNodeVM(subNode); nodeList.AddRange(subNodes); } return(nodeList); } else { List <TreeNodeVM> nodeList = new List <TreeNodeVM>(); nodeList.Add(node); return(nodeList); } }
void item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case "IsSelected": if ((sender as TreeNodeVM).NodeObj is ManualConnection) { foreach (var stepNode in (sender as TreeNodeVM).SubTreeNodeList) { stepNode.PropertyChanged -= item_PropertyChanged; stepNode.IsSelected = (sender as TreeNodeVM).IsSelected; stepNode.PropertyChanged += item_PropertyChanged; } } else { TreeNodeVM subNode = sender as TreeNodeVM; if (subNode.IsSelected == true) { if (subNode.ParentNode.SubTreeNodeList.Where(x => x.IsSelected == false).Count() == 0) { subNode.ParentNode.PropertyChanged -= item_PropertyChanged; subNode.ParentNode.IsSelected = true; subNode.ParentNode.PropertyChanged += item_PropertyChanged; } } else { if (subNode.ParentNode.SubTreeNodeList.Where(x => x.IsSelected == true).Count() < subNode.ParentNode.SubTreeNodeList.Count()) { subNode.ParentNode.PropertyChanged -= item_PropertyChanged; subNode.ParentNode.IsSelected = false; subNode.ParentNode.PropertyChanged += item_PropertyChanged; } } } break; } getSelectedUC(); }
private void item_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "IsSelected") { if ((sender as TreeNodeVM).NodeObj is ManualConnection) { foreach (var stepNode in (sender as TreeNodeVM).SubTreeNodeList) { stepNode.PropertyChanged -= item_PropertyChanged; stepNode.IsSelected = (sender as TreeNodeVM).IsSelected; stepNode.PropertyChanged += item_PropertyChanged; } } else { TreeNodeVM subNode = sender as TreeNodeVM; if (subNode.IsSelected == true) { if (subNode.ParentNode.SubTreeNodeList.Where(x => x.IsSelected == false).Count() == 0) { subNode.ParentNode.PropertyChanged -= item_PropertyChanged; subNode.ParentNode.IsSelected = true; subNode.ParentNode.PropertyChanged += item_PropertyChanged; } } else { if (subNode.ParentNode.SubTreeNodeList.Where(x => x.IsSelected == true).Count() < subNode.ParentNode.SubTreeNodeList.Count()) { subNode.ParentNode.PropertyChanged -= item_PropertyChanged; subNode.ParentNode.IsSelected = false; subNode.ParentNode.PropertyChanged += item_PropertyChanged; } } } } UpdateGuideMsglist(); }
public void AddSubNode(TreeNodeVM subNode) { SubTreeNodeList.Add(subNode); subNode.ParentNode = this; }