Runtime Services
Whenever you need to work with the capabilties of the adapter, you will do this by leveraging adapter services.
For example, to start using the Channels APIs you would first need to ask for the channels service.
var channels = runtime.GetService<IChannels>();
at this point you can then, for example, create a channels client ready to talk to any channels providers that maybe running within OpenFin.
var channelClient = channels.CreateClient("andy");
channelClient.Opened += (s, e) =>
{
Debug.WriteLine("The Channels Client has been Opened");
};
try
{
await channelClient.ConnectAsync();
}
catch
{
Debug.WriteLine("Channel Connection Failed");
}
This same pattern is used for the other major API groups within the adapter
As well as any extensions that may be in use.
One of the advantages of this method is the ability to mock these service requests during unit tests. This is discussed in more detail here.