Пример #1
0
 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);
     }
 }
Пример #2
0
 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();
 }
Пример #3
0
 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();
 }
Пример #4
0
 public void AddSubNode(TreeNodeVM subNode)
 {
     SubTreeNodeList.Add(subNode);
     subNode.ParentNode = this;
 }