Page 1 of 1

ServerOperations Delegates example (and specification)

Posted: Mon May 19, 2008 7:29 am
by HankFay
We use comments on checkin as one way of communicating within our small team. I'm thinking that getting these operations and comments and feeding either to RSS or to a specific Twitter account would be a good way of getting the news out. The ServerOperations ChangeSetOutputEventHandler Delegate seems like a candidate for getting that information. (Creating a Windows Service to do this from the Client side is the other possibility, but this seemed simpler and more to the point). Do you have or could you provide an example of using this delegate? Also, the ChangeSetItemColl collection doesn't seem to be specified in the API helpfile. Of course if you provide an example, I can inspect it, but I suspect you have the information lying around somewhere.

thanks,

Hank Fay

Posted: Mon May 19, 2008 10:36 am
by shannon
Hank,

The code for our command line client is included in the api zip (downloadable from our website). The clc uses the delegate here:

Code: Select all

		public VaultCmdLineClient(Args args, System.Xml.XmlWriter xml)
		{
			_args = args;
			_xml = xml;
			ServerOperations.GetInstance().ChangesetOutput += new ServerOperations.ChangesetOutputEventHandler(WriteChangeSet);
			ServerOperations.GetInstance().UserMessage += new ServerOperations.UserMessageEventHandler(WriteUserMessage);
		}
You can see the definitions for WriteUserMessage and WriteChangeSet in VaultCmdLineClient.cs

ChangeSetItemColl extends ArrayList. You can use foreach to loop over the ChangeSetItem objects the same way.

--Shannon

Posted: Mon May 19, 2008 1:32 pm
by shannon
If you could give me more details about what you're trying to do I might be able to suggest a better option for implementing it (or give a better example).