Page 1 of 1

C# Treeview vault folders

Posted: Wed Dec 07, 2011 5:50 am
by Ton Blokhuizen
I'm trying to create a C# userform with a Treeview on it.
What I would like to do is show the repository tree with folders (and files) just like the Vault client interface.

For some reason I'm not able to generate usable data for the treeview.

The things i have tried are:

Note that my application does not require to have a local working folder.
I'ts just a representation of the directory structure of the repository database.

The only thing I have accompiced is the use of the XMLHelper.
Like so: (following example found on this forum, used for listing Checkouts to XMl structure)

Code: Select all

VaultClientCheckOutList coList = ServerOperations.ProcessCommandListCheckOuts();
                

                // output the checkout list
                StringWriter sw = new StringWriter();
                System.Xml.XmlTextWriter xml = new XmlTextWriter(sw);
                xml.Formatting = System.Xml.Formatting.Indented;
                xml.WriteStartElement("root");

                xml.WriteStartElement("ListCheckOuts");
                XmlHelper.XmlOutput(xml, coList);
                xml.WriteEndElement();
I've tried using the ServerOperations.ProcessCommandListFolder But to retrieve any usable data you must pass it trough the XMLHelper.

I would like to have a simple collection or array containing just the folder and files, so i can pass it to my treeview control.

Any help is appreciated

Re: C# Treeview vault folders

Posted: Wed Dec 07, 2011 3:46 pm
by Beth
If you look at the thread here: http://support.sourcegear.com/viewtopic.php?f=31&t=8020, there's a good example in the post made by icnocop in the middle of the thread. You should be able to push each piece into your array as you go through it.


private void GetOldAndMissing(string path)
{
VaultClientFolder folder = ServerOperations.ProcessCommandListFolder(path, true);
//push folder to your array

foreach (VaultClientFile file in folder.Files)
{
//push the files to your array
}

foreach (VaultClientFolder subfolder in folder.Folders)
{
GetOldAndMissing(subfolder.FullPath);
}
}

Re: C# Treeview vault folders

Posted: Thu Dec 08, 2011 2:52 am
by Ton Blokhuizen
Thanx, this does the trick !
Very nice.

I was looking for a more detailed set of documantation regarding the usage of the API, but could not find any buth the helpfile shipped with the dsk.
Is there more documentation available ?

Re: C# Treeview vault folders

Posted: Thu Dec 08, 2011 11:20 am
by Beth
The client API should have a .chm file in the .zip file you downloaded.

All additional API help is in the Development Tips of the forum.

Re: C# Treeview vault folders

Posted: Mon Feb 20, 2012 11:07 am
by dellmerca
find here a simple C# treeviewer

http://csharp.net-informations.com/gui/cs-treeview.htm

dell.

Re: C# Treeview vault folders

Posted: Tue Feb 21, 2012 5:20 pm
by Beth
Thank you for providing the additional information.