Пример #1
0
 private void RefreshActionTreeCallback(IPBComponent pbComp, Type type)
 {
     ActionTree.SuspendLayout();
     foreach (TreeNode node in ActionTree.Nodes)
     {
         UdateTreeNode(node, pbComp, type, true);
     }
     ActionTree.ResumeLayout();
 }
Пример #2
0
 public void RefreshActionTree(IPBComponent pbComp, Type type)
 {
     // Don't update ActionTree while PB is running to improve performance.
     if (ProfessionbuddyBot.Instance.IsRunning || !IsValid)
     {
         return;
     }
     if (ActionTree.InvokeRequired)
     {
         ActionTree.BeginInvoke(new RefreshActionTreeDelegate(RefreshActionTreeCallback), pbComp, type);
     }
     else
     {
         RefreshActionTreeCallback(pbComp, type);
     }
 }
Пример #3
0
        private void UdateTreeNode(TreeNode node, IPBComponent pbComp, Type type, bool recursive)
        {
            var comp = (IPBComponent)node.Tag;

            if ((pbComp == null && type == null) ||
                (pbComp != null && pbComp == node.Tag) ||
                (type != null && type.IsInstanceOfType(node.Tag))
                )
            {
                var pbAction = comp as PBAction;
                node.ForeColor = pbAction != null && pbAction.HasErrors ? Color.Red : comp.Color;
                node.Text      = comp.Title;
            }
            if (recursive)
            {
                foreach (TreeNode child in node.Nodes)
                {
                    UdateTreeNode(child, pbComp, type, true);
                }
            }
        }
Пример #4
0
        private TreeNode GenerateTreeViewFromBehaviorTree(IPBComponent component, TreeNode node)
        {
            var newNode = new TreeNode(component.Title)
            {
                ForeColor = component.Color, Tag = component
            };

            if (node != null)
            {
                node.Nodes.Add(newNode);
            }

            var composite = component as PBComposite;

            if (composite != null)
            {
                foreach (var child in composite.Children.OfType <IPBComponent>())
                {
                    GenerateTreeViewFromBehaviorTree(child, newNode);
                }
            }
            return(newNode);
        }
Пример #5
0
 public void RefreshActionTree(IPBComponent pbComp)
 {
     RefreshActionTree(pbComp, null);
 }