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; } } }
public TreeNodeState Update() { if (this.state != TreeNodeState.RUNNING) { this.Start(); } this.state = this.Running(); if (this.state != this.Running()) { this.End(); } return(this.state); }
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); }
public void UpdateNode(TreeNodeState old, UnitTreeNode node) { if (old.IsVisible) { node.EnsureVisible(); } if (old.IsExpanded) { node.Expand(); } if (old.IsSelected) { this.typeTree.SelectedNode = node; } }
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); }
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); }
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); }
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)); } }
public void Reset() { this.state = TreeNodeState.NONE; }
/// <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)); }
/// <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()); } }
/// <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)); } }
/// <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; }