Search Results for

    Show / Hide Table of Contents

    Interface IRuntime

    Represents a connection to a given OpenFin runtime

    Namespace: OpenFin.Net.Adapter
    Assembly: OpenFin.Net.Adapter.dll
    Syntax
    public interface IRuntime

    Properties

    IsConnected

    Gets a value indicating whether this instance is connected.

    Declaration
    bool IsConnected { get; }
    Property Value
    Type Description
    System.Boolean

    true if this instance is connected; otherwise, false.

    RuntimeID

    Gets the runtime identifier.

    Declaration
    string RuntimeID { get; }
    Property Value
    Type Description
    System.String

    The runtime identifier.

    RuntimeOptions

    Gets the runtime options.

    Declaration
    RuntimeOptions RuntimeOptions { get; }
    Property Value
    Type Description
    RuntimeOptions

    The runtime options this instance was previously created with.

    Methods

    ConnectAsync()

    Connects this instance to the runtime specified in the runtime options.

    Declaration
    Task ConnectAsync()
    Returns
    Type Description
    Task

    Examples
    var factory = new RuntimeFactory();
    runtime = factory.GetRuntimeInstance(new RuntimeOptions
    {
      Version = "stable",
      UUID = "my-uuid",
      LicenseKey = "my-license-key"
    });
    
    try
    {
      await runtime.ConnectAsync();
    
      // Now connected
    }
    catch ( Exception ex )
    {
    
    }

    DisconnectAsync()

    Disconnects this instance.

    Declaration
    Task DisconnectAsync()
    Returns
    Type Description
    Task

    GetService<T>()

    Gets an instance of an adapter API service

    Declaration
    T GetService<T>()
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    Examples

    Simple example of requesting the IAB service and publishing

    var iab = runtime.GetService<IInterApplicationBus>();
    

    iab.Publish("my-topic", new { name = "someone" });

    RegisterService<TQueryInterface, TImplType>()

    Registers a new service implementation with the runtimes own service repository

    Declaration
    void RegisterService<TQueryInterface, TImplType>()
    Type Parameters
    Name Description
    TQueryInterface

    The type of the query interface.

    TImplType

    The type of the implementation type.

    Remarks

    This allows the runtime to be used as a container for objects that allows a single, easily mockable interface to be passed around an application

    Examples
    runtime.RegisterService<IMyService, MyServiceImplementationType>();
    ...
    var service = runtime.GetService<IMyService>();

    Events

    Connected

    Event that is fired after a successful runtime connection

    Declaration
    event EventHandler Connected
    Event Type
    Type Description
    EventHandler

    Disconnected

    Event that is fired afer a runtime disconnection occurs

    Declaration
    event EventHandler Disconnected
    Event Type
    Type Description
    EventHandler
    In This Article
    Back to top Copyright OpenFin