Skip to main content

Sample .NET projects

Our Finsemble .NET Seed Repository contains three example .NET projects:

Here is a sample AppD configuration to use the .NET seed project with the Finsemble seed project:

{
...
"apps": [
...
{
"appId": "WPFExample",
"name": "WPFExample",
"type": "native",
"details": {
"path": "C:/some/path/to/WPFExample.exe",
},
"hostManifests" : {
"Finsemble": {
"window": {
"windowType": "native",
"path": "PATH_TO_WPFExample.exe",
"autoShow": true,
"addToWorkspace": true
},
"foreign": {
"services": {
"workspaceService": {
"isArrangable": true
}
},
"components": {
"App Launcher": {
"launchableByUser": true
}
}
}
}
}
}
]
}

Using the WPF Window Title Bar

The WPF Example project provides the WPF Window Title Bar UI component. This component gives Finsemble's built-in window management functionality to .NET components. By using this component, .NET windows can participate in snapping, docking and linking.

Scrim

When data to be shared in Finsemble is dragged, a scrim is displayed on top of all components denoting whether or not the component can receive that data. You must create a control (generally a label) that occupies the entire space of the component, sits on top of all other controls, and is hidden. This is the control that will accept the dragged data from other components. Here is how to provide this control to Finsemble:

// Assuming the control is called Scrim
FSBL.DragAndDropClient.SetScrim(Scrim);

Styling the Window Title Bar

You can change the background and button hover colors using the functions below. All the buttons are styled identically except the "close" button and the docked state background of the "docking" button.

// FinsembleHeader is the name of the WPFWindowTitleBar Control

//Set title bar background colors
FinsembleHeader.SetActiveBackground(new SolidColorBrush(Colors.Red));
FinsembleHeader.SetInactiveBackground(new SolidColorBrush(Colors.DarkRed));

//Set button backgrounds on hover
FinsembleHeader.SetButtonHoverBackground(new SolidColorBrush(Colors.Purple));
FinsembleHeader.SetInactiveButtonHoverBackground(new SolidColorBrush(Colors.Yellow));
FinsembleHeader.SetCloseButtonHoverBackground(new SolidColorBrush(Colors.SeaShell));
FinsembleHeader.SetInactiveCloseButtonHoverBackground(new SolidColorBrush(Colors.BurlyWood));

//Set docking button background when docked
FinsembleHeader.SetDockingButtonDockedBackground(new SolidColorBrush(Colors.BlanchedAlmond));

//Set text colors
FinsembleHeader.SetTitleForeground(new SolidColorBrush(Colors.LightGoldenrodYellow));
FinsembleHeader.SetButtonForeground(new SolidColorBrush(Colors.LightSalmon));

//Set Fonts for title and buttons.
//Use null for fontFamily, fontStyle and fontWeight to not change. Use 0 for fontSize to not change.
FinsembleHeader.SetTitleFont(fontFamily, fontSize, fontStyle, fontWeight);
FinsembleHeader.SetButtonFont(fontFamily, fontSize, fontStyle, fontWeight);

Authenticating with a .NET application

The main window of the Authentication Example application needs to be initialized. However, this authentication window cannot use the WPF Window Title Bar because the services are not available until authenticated. Once the user is authenticated, you need to call PublishAuthorization:

FSBL.RPC("AuthenticationClient.publishAuthorization", new JArray { username, credentials});

Getting user credentials

If your application requires credentials from Finsemble, you can call GetCurrentCredentials:

FSBL.RPC("AuthenticationClient.getCurrentCredentials", new List<JObject>(), (err, credentials) => {
});

Using a .NET application as an App Service

You can also have .NET applications that do not display a window to interoperate with other components via the Router or FDC3. This allows for the integration of a .NET application as a service within Finsemble. An example of such an integration is provided in the Windowless Example project.

App services created from .NET applications should be added to the Finsemble apps configuration. To add a .NET app service to Finsemble, add it to the public/configs/application/apps.json file as normal and ensure that you set:

  • hostManifests.Finsemble.appService to true
  • a hostManifests.Finsemble.window.name field to help you identify the component in the Central Logger

The component may be launched using a path or alias and can be passed arguments in the same way as any other native component.

For example:

{
...
"apps": [
...
{
"appId": "WPFExample",
"name": "WPFExample",
"type": "native",
"details": {
"path": "C:/some/path/to/WPFExample.exe",
},
"hostManifests" : {
"Finsemble": {
"appService": true,
"window": {
"name": "winlessSeed",
"windowType": "native",
"alias": "windowlessExample",
"arguments": "arg1 arg2 arg3"
}
}
}
}
]
}

For more details see App services.


See also

The basics of integrating native components is covered in this tutorial.

For information about authentication, check out the Authentication tutorial.

Understanding how the Linker Client works is important for understanding this tutorial.