/// <summary>
/// Creates a tree node and add it to the <c>TreeNodeCollection</c>.
/// </summary>
/// <param name = "text">The text displayed in the label of the tree node.</param>
/// <param name = "path">The path the node represents.</param>
/// <param name = "addDummyNode">True to add + sign, otherwise no + sign appears.</param>
/// <param name = "forceChecked">True to check node in each case, otherwise false to allow normal check against selected paths.</param>
/// <param name = "isSpecialFolder">Specifies if this node is a special folder. Special folders do not request data from the attached data provider.</param>
/// <returns></returns>
public virtual TreeNodePath CreateTreeNode(string text, string path, bool addDummyNode, bool forceChecked,
bool isSpecialFolder)
{
TreeNodePath newNode = new TreeNodePath(text, isSpecialFolder);
// path
newNode.Path = path;
//
try
{
_treeView.SupressCheckEvent(true);
//
if (forceChecked)
{
newNode.Checked = true;
}
else
{
newNode.Checked = _treeView.SelectedDirectories.Contains(path);
}
_treeView.MarkNode(newNode);
}
catch (Exception e)
{
Debug.WriteLine(e.Message, _treeView.Name);
}
finally
{
_treeView.SupressCheckEvent(false);
}
//
if (addDummyNode)
{
// add dummy node, otherwise there is no + sign
newNode.AddDummyNode();
}
//
return(newNode);
}