private void checkChildren(ModelDirectory dir) { if (dir.isParent()) { List <ModelDirectory> children = dir.children; foreach (ModelDirectory child in children) { TreeNode[] nodes = treeView1.Nodes.Find(child.id, true); //Directory.id to jest TreeNode.Name nodes[0].Checked = true; //zawsze jest tylko jedna, bo index jest unikalny } } }
private TreeNode createDirectoryNode(ModelDirectory dir) { var dirNode = new TreeNode(dir.name); try { dirNode.Name = dir.id; if (dir.isParent()) { foreach (var child in dir.children) { dirNode.Nodes.Add(createDirectoryNode(child)); } } } catch (NullReferenceException ex) { MyMessageBox.display(ex.Message + " \r\nbłąd createDirectoryNode"); } return(dirNode); }