Search Results for

    Show / Hide Table of Contents

    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

    • IChannels
    • IInterApplicationBus
    • IInterop

    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.

    In This Article
    Back to top Copyright OpenFin