/// <summary> /// this method sets image index for this currentTestTypeRootNode /// </summary> private void SetTreeNodeImageIndex() { if (this.AutomationElementTreeControl.InvokeRequired) { this.AutomationElementTreeControl.BeginInvoke(new MethodInvoker(SetTreeNodeImageIndex)); } else { ImageIndexes imageIndex = ImageIndexes.GeneralNode; if (this._isNodeLive) { imageIndex = ImageIndexes.NodeIsLive; } if (this._childrenStatus == ChildrenElementsStatus.NotPopulated) { imageIndex = ImageIndexes.NodeBeeingRefreshed; } if (this._errorInPopulatingChildren) { imageIndex = ImageIndexes.GeneralError; } this.TreeNode.ImageIndex = this.TreeNode.SelectedImageIndex = (int)imageIndex; } }
private TreeNode CreateTreeNode(string text, ImageIndexes imageIndex, IEnumerable <TreeNode> children = null, object tag = null, bool expand = false) { TreeNode tn; if (children == null) { tn = new TreeNode(text, (int)imageIndex, (int)imageIndex); } else { tn = new TreeNode(text, (int)imageIndex, (int)imageIndex, children.ToArray()); } tn.Tag = tag; if (expand) { tn.Expand(); } return(tn); }