ServerOperations Delegates example (and specification)

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
HankFay
Posts: 21
Joined: Thu Sep 08, 2005 11:40 am

ServerOperations Delegates example (and specification)

Post by HankFay » Mon May 19, 2008 7:29 am

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

shannon

Post by shannon » Mon May 19, 2008 10:36 am

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

shannon

Post by shannon » Mon May 19, 2008 1:32 pm

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).

Post Reply