To call the service from .net code, it's very simple.
If you reference the dll in Visual Studio then you can simply do the following:

// See if there are any servers already on the network
ApplicationState.SniffForServer();

// Clear and Initialise all of the repositories
RepositoryInstances.Refresh();

it's that simple!! (ApplicationState also has a property of 'IsClient' which can determine if a server was successfully found)

Alternatively, you can do things with a lot more flexibility:

// The following line will get a list of all the zones stored on the service
var zones = ClientCommon.Service.GetGroups(GroupType.Zone);

// The following line will get the items (and their states) belonging to a specific group/zone/macro
var zone = ClientCommon.Service.GetGroup(groupId);
The service has been written in .net 4.0, so takes full advantage of the new tools provided by Microsoft. Most noticably is the 'Help' feature. If you navigate to http://computername:port/bbsbservice/help then you will get instant details on all the methods available, what parameters they take, and what they return (with examples). It also takes advantage of the Publisher/Subscriber pattern for automatically updating the state of any clients if the server gets updated.

Last edited Oct 13, 2010 at 3:31 PM by evorgevol, version 2

Comments

No comments yet.