コード例 #1
0
        private void Update()
        {
            if (running)
            {
                if (!startNode.Started)
                {
                    startNode.StartNode();
                    return;
                }
                TreeNodeState state = startNode.UpdateNode();
                switch (state)
                {
                case TreeNodeState.running:
                    return;

                    break;

                default:
                    running = false;
                    startNode.Complete();
                    break;
                }
                if (repeat && !running)
                {
                    running = true;
                }
            }
        }
コード例 #2
0
 public TreeNodeState Update()
 {
     if (this.state != TreeNodeState.RUNNING)
     {
         this.Start();
     }
     this.state = this.Running();
     if (this.state != this.Running())
     {
         this.End();
     }
     return(this.state);
 }
コード例 #3
0
 public override TreeNodeState Running()
 {
     for (int i = 0; i < base.children.Count; i++)
     {
         TreeNodeState state = base.children[i].Update();
         if (state != TreeNodeState.SUCCESS)
         {
             base.state = state;
             return(base.state);
         }
     }
     return(TreeNodeState.SUCCESS);
 }
コード例 #4
0
 public void UpdateNode(TreeNodeState old, UnitTreeNode node)
 {
     if (old.IsVisible)
     {
         node.EnsureVisible();
     }
     if (old.IsExpanded)
     {
         node.Expand();
     }
     if (old.IsSelected)
     {
         this.typeTree.SelectedNode = node;
     }
 }
コード例 #5
0
            internal static TreeNodeState Create(OdcTreeNode node)
            {
                var state = new TreeNodeState
                {
                    text         = node.Text,
                    value        = node.Value,
                    imageUrl     = node.ImageUrl,
                    key          = node.Key,
                    isExpanded   = node.IsExpanded,
                    childNodes   = node.ChildNodes.SaveViewState(),
                    isChecked    = node.IsChecked,
                    showCheckBox = node.ShowCheckBox,
                    populate     = node.PopulateOnDemand,
                    cssClass     = node.CssClass,
                };

                return(state);
            }
コード例 #6
0
 public override void VisitNode(UnitTreeNode node)
 {
     if (this.loading)
     {
         TreeNodeState old = this.states[node.FullPath] as TreeNodeState;
         if (old != null)
         {
             this.tree.Invoke(this.updateNode, new Object[] { old, node });
         }
     }
     else
     {
         if (node.IsExpanded || node.IsVisible || node.IsSelected)
         {
             this.states[node.FullPath] = new TreeNodeState(node);
         }
     }
     base.VisitNode(node);
 }
コード例 #7
0
ファイル: SelectorNode.cs プロジェクト: radiomonter/Tanki_X
 public override TreeNodeState Running()
 {
     for (int i = base.currentChildIndex; i < base.children.Count; i++)
     {
         TreeNodeState state = base.children[i].Update();
         if (state != TreeNodeState.FAILURE)
         {
             base.state             = state;
             base.currentChildIndex = i;
             for (int j = 0; j < base.children.Count; j++)
             {
                 if (j != i)
                 {
                     base.children[j].Reset();
                 }
             }
             return(base.state);
         }
     }
     return(TreeNodeState.FAILURE);
 }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: bakakamo/TadaBuild
 private void SetNodeState(TreeNode node, TreeNodeState state)
 {
     node.StateImageIndex = (int)state;
     if (state < TreeNodeState.Indeterminate)
     {
         SetChecked(node.Nodes, state != TreeNodeState.Unchecked);
     }
     if (node.Parent != null)
     {
         SetNodeState(node.Parent, GetState(node.Parent.Nodes));
     }
 }
コード例 #9
0
 public void Reset()
 {
     this.state = TreeNodeState.NONE;
 }
コード例 #10
0
 /// <summary>
 /// When implemented by a class, saves the changes to a server control's view state to an <see cref="T:System.Object"/>.
 /// </summary>
 /// <returns>
 /// The <see cref="T:System.Object"/> that contains the view state changes.
 /// </returns>
 public object SaveViewState()
 {
     return(TreeNodeState.Create(this));
 }
コード例 #11
0
ファイル: TreeNode.cs プロジェクト: LaudableBauble/Bedlam
        /// <summary>
        /// If the node has been either collapsed or expanded, fire an event.
        /// </summary>
        /// <param name="state">The state of this node in the tree view; that is whether it is collapsed, expanded or neither.</param>
        private void NodeStateChangedInvoke(TreeNodeState state)
        {
            //Change the state.
            _NodeState = state;
            //Update the childrens' states.
            CollapseOrExpand();

            //If someone has hooked up a delegate to the event, fire it.
            if (NodeStateChanged != null) { NodeStateChanged(this, new EventArgs()); }
        }
コード例 #12
0
ファイル: TreeNode.cs プロジェクト: LaudableBauble/Bedlam
        /// <summary>
        /// If the node has had a child node added to it, see if it has to expand itself and then fire the event.
        /// </summary>
        private void ChildNodeAddedInvoke(TreeNode child)
        {
            //If this was the first child node added, expand the node and then fire the event.
            if (_Nodes.Count == 1) { _NodeState = TreeNodeState.Expanded; }

            //If someone has hooked up a delegate to the event, fire it.
            if (ChildNodeAdded != null) { ChildNodeAdded(this, new ChildNodeAddedEventArgs(this, child)); }
        }
コード例 #13
0
ファイル: TreeNode.cs プロジェクト: LaudableBauble/Bedlam
        /// <summary>
        /// Initialize the treeview node.
        /// </summary>
        /// <param name="gui">The GUI that this node will be a part of.</param>
        /// <param name="position">The position of this trenodeeview.</param>
        /// <param name="height">The height of this treenodeview.</param>
        /// <param name="width">The width of this treevnodeiew.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Nodes = new List<TreeNode>();
            _Button = new Button(gui, new Vector2(Position.X, Position.Y + (Height / 3)));
            _Checkbox = new Checkbox(gui, new Vector2(Position.X + _Button.Width + 2, Position.Y), width, height);
            _NodeState = TreeNodeState.None;

            //Add the items to the list.
            Add(_Button);
            Add(_Checkbox);

            //Hook up some events.
            _Checkbox.CheckboxTick += OnCheckboxTicked;
            _Button.MouseClick += OnButtonMouseClick;
        }