Extensions
Adapter extensions are a way of adding optional functionality to the .NET adapter. You can add use extensions for functionality you need, and omit those for what you don't need.
An extension is shipped as a separate NuGet package, which you will need to reference and then install as part of the runtime creation phase.
For example, out of the box, the adapter provides debug logging only to the console, but we provide an extension that extends the logging capabilities to log to a file using SeriLog.
You can see below the use of the UseSerilogLogging()
method as part of Runtime creation. This takes care of adding the logging the capabilities to the newly-created Runtime instance.
var runtime = new RuntimeFactory()
.UseSeriLogLogging()
.GetRuntimeInstance(new RuntimeOptions
{
Version = "stable",
UUID = "UUID_STRING",
LicenseKey = "LICENSE_KEY"
});
Another example of an extension is the desktop system extension (OpenFin.Net.Adapter.Extensions.DesktopSystem). Once enabled, this allows you to call a variety of OpenFin desktop APIs.
For example, assuming you have reference the OpenFin.Net.Adapter.Extensions.DesktopSystem package:
var runtime = new RuntimeFactory()
.UseSeriLogLogging()
.UseDesktopSystem()
.GetRuntimeInstance(new RuntimeOptions
{
Version = "stable",
UUID = "UUID_STRING",
LicenseKey = "LICENSE_KEY"
});
await runtime.ConnectAsync();
var desktop = runtime.GetService<IDesktopSystem>();
var runningApps = desktop.GetAllApplicationsAsync();
foreach ( var app in runningApps) {
Debug.WriteLine( app.UUID );
}