I am creating a TFS tool that will receive change information from a TFS server.
Now I want to provide a "TFS Browser" so that the user can view which "branch / folder" he wants to get from.
I use the TreeView control and the GetItems function to get the path to the elements from TFS:
private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
e.Node.Nodes.RemoveAt(0);
RecursionType recursion = RecursionType.OneLevel;
Item[] items = null;
ItemSet itemSet = sourceControl.GetItems(e.Node.Tag.ToString(), recursion);
items = itemSet.Items;
foreach (Item item in items)
{
if (item.ServerItem == e.Node.Tag.ToString())
continue;
string filename = Path.GetFileName(item.ServerItem);
if (Path.GetExtension(filename) == "")
{
TreeNode node = new TreeNode(filename, new TreeNode[] { new TreeNode() });
node.Tag = item.ServerItem;
e.Node.Nodes.Add(node);
}
}
}
The code below shows that after clicking the "expand" button from a node, the application will "request" elements below the current "branch" (e).
. , , "" , , , . , , "v1.1".
. GetItems . MSDN:
path , , . , , . , .
GetItems , , "" node .
, "" TFS? , , ?
!