Canguro.Controller.Grid.SectionsTreeView.setImages C# (CSharp) Method

setImages() private method

private setImages ( TreeNodeCollection tnc ) : TreeNode
tnc TreeNodeCollection
return TreeNode
        private TreeNode setImages(TreeNodeCollection tnc)
        {
            TreeNode selectedNode = null, tmpNode = null;
            foreach (TreeNode tn in tnc)
            {
                if (tn.FirstNode == null)
                {
                    if (tn.Tag == section)
                        selectedNode = tn;
                    if (tn != null && tn.Tag != null && ((FrameSection)tn.Tag).Shape != null)
                        tn.SelectedImageKey = tn.ImageKey = ((FrameSection)tn.Tag).Shape + "Section";
                }
                else
                {
                    tn.SelectedImageKey = tn.ImageKey = tn.Text + "Section";
                    tmpNode = setImages(tn.Nodes);
                    if (selectedNode == null)
                        selectedNode = tmpNode;
                }
            }

            return selectedNode;
        }