### Install and Start Applications (JavaScript)
Source: https://docs.interop.io/browser/tutorials/javascript/index
Commands to install dependencies and start all applications in the `/start` directory. This assumes a Node.js environment with npm installed.
```bash
npm install
npm start
```
--------------------------------
### Unattended Installation with Command Line Arguments
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
This example demonstrates how to initiate an unattended installation of io.Connect Desktop using command-line arguments. It includes options for specifying a client key, using an extensibility configuration file, and performing a hidden installation.
```shell
io-connect-desktop.exe /unattended /clientKey:myValidClientKey /ext:extensibility.json
```
--------------------------------
### Define Workspace Layout Plugins in Clients App
Source: https://docs.interop.io/browser/tutorials/javascript/index
This code snippet demonstrates how to define plugins within the Clients application's start() function to fetch workspace layout definitions. It includes two critical plugins: 'Setup Applications' and 'Setup Workspace Layouts', each with a specified URL and a start function. This setup is essential for dynamically loading and applying workspace layouts.
```javascript
const plugins = {
definitions: [
{
name: "Setup Applications",
config: { url: "http://localhost:8080/api/applications"},
start: setupApplications,
critical: true
},
{
name: "Setup Workspace Layouts",
config: { url: "http://localhost:8080/api/layouts"},
start: setupLayouts,
critical: true
}
]
};
const config = {
licenseKey: "my-license-key",
channels,
plugins
};
const { io } = await IOBrowserPlatform(config);
window.io = io;
```
--------------------------------
### Install Dependencies and Start Angular Apps
Source: https://docs.interop.io/browser/tutorials/angular/index
This command installs all necessary project dependencies for the Angular applications. It is a prerequisite for running the apps locally.
```bash
npm install
npm start
```
--------------------------------
### Create Application and Website Shortcuts
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
Demonstrates creating multiple shortcuts for io.Connect Desktop with different command-line arguments and a shortcut to an external website. Icons can be specified and copied from the installer artifacts or directly from a path. Shortcuts can be placed on the Desktop and in the Start Menu.
```json
{
"shortcuts": [
{
"type": "shortcut",
"args": {
"artifact": "Desktop",
"icon": "copy:icon.ico",
"filename": "My Custom Product DEV",
"desktop": true,
"startMenu": true,
"description": "Start My Custom Product in DEV environment.",
"targetArguments": "-- config=config/system.json configOverrides config0=config/system-override-DEV.json"
}
},
{
"type": "shortcut",
"args": {
"artifact": "Desktop",
"icon": "copy:icon.ico",
"filename": "My Custom Product UAT",
"desktop": true,
"startMenu": true,
"description": "Start My Custom Product in UAT environment.",
"targetArguments": "-- config=config/system.json configOverrides config0=config/system-override-UAT.json"
}
},
{
"type": "shortcut",
"args": {
"target": "https://interop.io",
"filename": "interop.io Official Site",
"description": "Open the interop.io official site",
"icon": "io.Connect Desktop/Desktop/assets/images/logo.ico",
"startMenu": false,
"desktop": true
}
}
]
}
```
--------------------------------
### Initialize @interopio/desktop Library with IOConnectNg
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/angular/index
Demonstrates the initialization of the @interopio/desktop library using the IOConnectNg module's forRoot() method. This example shows how to provide the desktop factory function for a desktop application context. It imports necessary modules and configures the application module for initialization.
```typescript
import { IOConnectNg } from "@interopio/ng";
import IODesktop from "@interopio/desktop";
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
IOConnectNg.forRoot({ desktop: { factory: IODesktop } })
],
providers: [],
bootstrap: [AppComponent]
});
export class AppModule { };
```
--------------------------------
### Basic Feedback App Setup with IssueReportingProvider
Source: https://docs.interop.io/desktop/capabilities/more/features/index
This example demonstrates the fundamental setup of a custom Feedback app using the `IssueReportingProvider` from `@interopio/components-react`. The provider component wraps the custom feedback component, making feedback-related data and functionality accessible via the `useIssueReportingContext` hook. This is a prerequisite for using any feedback features.
```javascript
import { IssueReportingProvider } from "@interopio/components-react";
import CustomFeedback from "./CustomFeedback";
const App = () => {
return (
);
};
export default App;
```
--------------------------------
### Start Application Instance Method
Source: https://docs.interop.io/desktop/reference/javascript/app%20management/index
Provides the signature for starting an application instance. This method can accept optional context and start options, returning a Promise that resolves to the application instance.
```typescript
type Instance = any; // Placeholder for actual Instance type
type ApplicationStartOptions = object; // Placeholder for actual ApplicationStartOptions type
// Signature for start method
(context?: object, options?: ApplicationStartOptions) => Promise;
```
--------------------------------
### Start Stocks App with Context (Channel) using App Management API (JavaScript)
Source: https://docs.interop.io/desktop/tutorials/javascript/index
This JavaScript snippet shows how to start the 'stocks' application with a specific context, including joining the current channel. It retrieves the 'stocks' application, gets the current channel using `io.channels.my()`, defines the context with the channel, and then starts the app with this context. Errors during startup are caught and logged.
```javascript
const stocksApp = io.appManager.application("stocks");
// Retrieving the current Channel.
const currentChannel = io.channels.my();
// Starting context for the "Stocks" app.
const context = { channel: currentChannel };
stocksApp.start(context).catch(console.error);
```
--------------------------------
### Configure Application Loading Plugin (JavaScript)
Source: https://docs.interop.io/browser/tutorials/react/index
This code configures a plugin for loading application definitions. It imports `setupApplications` and defines a plugin named 'Setup Applications'. The plugin uses a provided URL to fetch definitions and is set to start automatically with `critical: true`, meaning the main app will wait for it to complete before initializing. This configuration is passed to the `IOConnectProvider` settings.
```javascript
import { setupApplications } from "./plugins/applicationsPlugin";
// Define a Plugin.
const plugins = {
definitions: [
{
name: "Setup Applications",
config: { url: "http://localhost:8080/api/applicationsReact"},
start: setupApplications,
critical: true
}
]
};
const config = { channels, plugins };
const settings = {
browserPlatform: {
factory: IOBrowserPlatform,
config
}
};
const domElement = document.getElementById("root");
const root = createRoot(domElement);
root.render(
);
```
--------------------------------
### Execute External Program with io.Connect Installer
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
The 'run' extensibility item allows executing an external program during the installation process. It supports specifying command-line arguments, exit code handling, hiding the process, and hiding the installer itself. This is useful for running custom scripts or tools as part of the installation.
```json
{
"extensibility": {
"run": {
"filename": "C:\\Program Files\\MyProgram\\myprogram.exe",
"args": "/install /silent",
"hide": true,
"hideInstaller": false,
"exitCode0": "Success",
"exitCode1": "Error: Installation failed."
}
}
}
```
--------------------------------
### Initialize io.Connect Desktop in Node.js
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/nodejs/index
Initializes the io.Connect Desktop environment in a Node.js application. If the app is started by io.Connect Desktop, authentication is not required. The example includes a timeout to prevent premature exit, which should be removed in production.
```javascript
const IODesktop = require("@interopio/desktop");
// This will prevent the app from exiting when io.Connect is initialized.
// Remove in real apps.
setTimeout(()=>{
console.log("Done.");
}, 10000);
const initializeIOConnect = async () => {
// Optional configuration for initializing the library.
const config = { appManager: "full" };
// Use the object returned by the factory function to access the io.Connect APIs.
const io = await IODesktop(config);
// Here io.Connect is initialized and you can access all io.Connect APIs.
console.log(`io.Connect version: ${io.version}`);
};
initializeIOConnect().catch(console.error);
```
--------------------------------
### Configure Startup Extensibility Point: License, Logo, Banner
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
This configuration demonstrates how to use the 'startup' extensibility point to provide custom license files, logos, and banners for the installer. It shows how to specify local files or URLs for these assets and define click actions for logos and banners.
```json
{
"startup": [
// Use a predefined license file.
{
"type": "license",
"args": {
// Either a path or a URL.
"file": "license.json"
}
},
// Logo to display in the top-left corner.
{
"type": "logo",
"args": {
// Either a path or a URL.
"url": "https://example.com/logo.png",
// URL to open when the user clicks on the logo.
"onClick": "https://example.com"
}
},
// Banner during installation.
{
"type": "banner",
"args": {
// Either a path or a URL.
"file": "banner.png",
// URL to open when the user clicks on the banner.
"onClick": "https://example.com"
}
}
]
}
```
--------------------------------
### Open URL in Default Browser (JavaScript)
Source: https://docs.interop.io/desktop/capabilities/more/features/index
Provides a JavaScript example of how to open a URL in the default browser using the io.Connect Desktop App Management API. It involves getting the 'open-browser' application instance and starting it with the target URL.
```javascript
const url = "https://interop.io";
await io.appManager.application("open-browser").start({ url });
```
--------------------------------
### Implement Plugin to Fetch and Import App Definitions
Source: https://docs.interop.io/browser/tutorials/javascript/index
This code demonstrates the implementation of a Plugin's `setupApplications` function. It fetches app definitions from a provided URL using `fetchAppDefinitions` and then dynamically imports them into the App Management API's in-memory store using `io.appManager.inMemory.import()`. Errors during this process are caught and logged.
```javascript
// In `setupApplications()`.
try {
const appDefinitions = await fetchAppDefinitions(url);
await io.appManager.inMemory.import(appDefinitions);
} catch (error) {
console.error(error.message);
};
```
--------------------------------
### Test Launching and Loading Apps with @interopio/desktop
Source: https://docs.interop.io/desktop/developers/testing/index
Demonstrates how to launch the 'Client List' application using the `@interopio/desktop` library, wait for it to load, and then interact with a button to open the 'Client Portfolio' application.
```javascript
test("Launch Client List and click the button to open Client Portfolio.", async () => {
// Open the "Client List" app using the `@interopio/desktop` library and wait for it to appear.
io.appManager.application("channelsclientlist").start();
const { page } = await waitForAppToLoad("channelsclientlist", electronApp);
// Click on the "Open Client Portfolio" button.
page.locator("button.btn.btn-icon.btn-primary.btn-borderless").click();
// Wait for the "Client Portfolio" app to appear.
await waitForAppToLoad("channelsclientportfolio", electronApp);
});
```
--------------------------------
### Initialize io.Connect Desktop Environment for Tests
Source: https://docs.interop.io/desktop/developers/testing/index
Sets up the testing environment by launching io.Connect Desktop, waiting for essential applications to load, and initializing the `@interopio/desktop` library. It also captures the page object for the Workspaces App for subsequent use.
```javascript
test.beforeAll(async () => {
// Start io.Connect Desktop.
electronApp = await electron.launch({
executablePath: executablePath,
cwd: platformDir
// You can also specify command line arguments for the io.Connect Desktop executable as an array of strings:
// args: ["config=config/system.json", "configOverrides", "config0=config/system-PROD-EMEA.json"]
});
// List of apps to await.
const appNames = ["io-connect-desktop-toolbar", "workspaces-demo"];
// Wait for the specified apps to appear.
const [toolbarApp, workspacesApp] = await waitForAppsToLoad(appNames, electronApp);
// Wait for the Workspaces App to initialize its io.Connect library and the Workspaces API.
await workspacesApp.page.waitForFunction("window.io && window.io.workspaces !== undefined");
// Set the Workspaces App page globally so it can be used in the following tests.
workspacesPage = workspacesApp.page;
// Initialize the `@interopio/desktop` library.
io = await initDesktop(toolbarApp.page);
});
```
--------------------------------
### Install @interopio/desktop Library
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/nodejs/index
Installs the necessary library for Node.js desktop integration. This is the first step to enable interop functionalities in your Node.js applications.
```bash
npm install @interopio/desktop
```
--------------------------------
### Get Starting Context Reader (C)
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/c-exports/index
Obtains a reader for the io.Connect starting context. Data can be read from this context using io.Connect methods prefixed with `glue_read_`.
```c
extern "C" GLUE_LIB_API const void* __cdecl glue_get_starting_context_reader();
```
--------------------------------
### Launch io.Connect Desktop with Arguments
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
Automatically launches io.Connect Desktop after installation with specified command-line arguments. This uses the 'context' extensibility point to set launch arguments and the 'done' point to initiate the launch.
```json
{
"context": [
{
"type": "setValue",
"args": {
"name": "LaunchGDArgs",
"value": "command-line-arguments"
}
}
],
"done": [
"launchGD"
]
}
```
--------------------------------
### Get App Instance Start Details
Source: https://docs.interop.io/desktop/capabilities/app-management/javascript/index
Retrieves information about how an app instance was started using the `startedBy()` method of an `Instance` object. Available since io.Connect Desktop 9.3.
```javascript
const startDetails = await io.appManager.myInstance.startedBy();
console.log(startDetails);
```
--------------------------------
### Full Browser Platform Initialization with Layouts
Source: https://docs.interop.io/browser/capabilities/windows/workspaces/enabling-workspaces/index
This comprehensive example shows the complete initialization of the Interop.io Browser Platform. It includes the license key, Workspaces App source, Workspaces API library, and detailed layout configuration for managing workspace layouts, including session-based or IndexedDB persistence and predefined local layouts.
```javascript
import IOBrowserPlatform from "@interopio/browser-platform";
import IOWorkspaces from "@interopio/workspaces-api";
const config = {
licenseKey: "my-license-key",
workspaces: {
src: "https://my-workspaces-app.com"
},
browser: {
libraries: [IOWorkspaces]
},
layouts: {
mode: "session",
// Layout definition objects of type "Workspace".
local: [ {...}, {...}]
}
};
const { io } = await IOBrowserPlatform(config);
```
--------------------------------
### System Folder Settings for Extensible Installer
Source: https://docs.interop.io/desktop/getting-started/changelog/9-4/index
Sets the locations for the Windows "Desktop" and "Start Menu" folders when repackaging the io.Connect Desktop installer.
```APIDOC
## Configuration: System Folder Settings
### Description
Configures the target locations for the Windows "Desktop" and "Start Menu" folders during the repackaging of the io.Connect Desktop installer.
### Configuration File
Extensibility configuration file
### Configuration Snippet
```json
{
"context": [
{
"type": "setValue",
"args": {
"name": "DesktopFolder",
"value": "%Public%/Desktop"
}
},
{
"type": "setValue",
"args": {
"name": "StartMenuFolder",
"value": "%ProgramData%/Microsoft/Windows/Start Menu/Programs/io.Connect Desktop"
}
}
]
}
```
### Parameters
- **context** (array) - An array of extensibility context operations.
- **type** (string) - The type of operation, should be `"setValue"`.
- **args** (object)
- **name** (string) - The name of the system folder to set (`"DesktopFolder"` or `"StartMenuFolder"`).
- **value** (string) - The desired path for the system folder.
```
--------------------------------
### Start Stock Details App Instance with Options (JavaScript)
Source: https://docs.interop.io/desktop/tutorials/javascript/index
This snippet demonstrates how to start a new instance of the 'Stock Details' application using the App Management API. It includes logic to check for existing instances with the same stock context and defines custom `ApplicationStartOptions` to control the new instance's position and size, ignoring saved layouts. The `stock` object is passed as context to the new instance.
```javascript
const detailsApp = io.appManager.application("stock-details");
// Check whether an instance with the selected stock is already running.
const contexts = await Promise.all(
// Use the `instances` property to get all running app instances.
detailsApp.instances.map(instance => instance.getContext())
);
const isRunning = contexts.find(context => context.RIC === stock.RIC);
if (!isRunning) {
// Starting options for the "Stock Details" app.
const options = {
// Ignore the last saved app bounds for the "Stock Details" app.
ignoreSavedLayout: true,
left: 100,
top: 100,
width: 550,
height: 350
};
// Start the app and pass the `stock` as context.
detailsApp.start(stock, options).catch(console.error);
}
```
--------------------------------
### Launch io.Connect Desktop with Custom Configuration (Command Line)
Source: https://docs.interop.io/desktop/developers/configuration/system/index
This command-line template allows launching io.Connect Desktop with a base configuration file and one or more custom override configuration files. It's useful for setting up environment-specific settings.
```bash
io-connect-desktop.exe [optional Electron arguments] -- config= configOverrides config0= config1=...
```
```bash
io-connect-desktop.exe -- config=config/system.json configOverrides config0=config/system-PROD-EMEA.json
```
--------------------------------
### Copy Custom Resources using xcopy
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
Demonstrates copying a custom directory to the io.Connect Desktop installation folder using the 'xcopy' command. This example references the installation path using the '%INSTALL_PATH%' environment variable.
```batch
xcopy /E splash "%INSTALL_PATH%\io.Connect Desktop\Desktop\assets\splash"
```
--------------------------------
### Setup io.Connect Seed Project
Source: https://docs.interop.io/desktop/developers/seed-project/index
Prepares the io.Connect seed project by installing selected platform components and dependencies for customizable applications. This command is essential after installing project dependencies.
```bash
npm run setup
```
--------------------------------
### WPF Integration Example
Source: https://docs.interop.io/desktop/capabilities/windows/window-management/net/index
A minimalistic WPF example demonstrating how to initialize io.Connect and register a main window as an io.Connect Window.
```APIDOC
## WPF Application Setup
### Description
This section provides a basic example of integrating the Window Management API within a WPF application.
### App.xaml Initialization
```csharp
public partial class App : Application
{
public static Glue42 io;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
io = new Glue42();
io.Initialize("MyDemo");
}
}
```
### MainWindow.xaml.cs Registration
```csharp
public partial class MainWindow : Window
{
public async MainWindow()
{
InitializeComponent();
var options = App.io.GlueWindows.GetStartupOptions() ?? new GlueWindowOptions();
options.WithType(GlueWindowType.Flat).WithTitle("Example Window");
// Register the window.
IGlueWindow myWindow = await App.io.GlueWindows.RegisterStartupWindow(this, "My Main Window", options);
}
}
```
```
--------------------------------
### Complete Dash Glue42 Interop Example
Source: https://docs.interop.io/desktop/capabilities/data-sharing/interop/dash/index
A comprehensive example demonstrating Interop method invocation within a Dash application using dash_glue42. It includes UI components, method invocation setup, and callbacks for triggering and handling results.
```python
import dash
from dash.exceptions import PreventUpdate
from dash.dependencies import Input, Output, State
import dash_html_components as html
import dash_core_components as dcc
import dash_glue42
from run import server
app = dash.Dash(__name__, server=server, routes_pathname_prefix="/app-a/")
app.layout = dash_glue42.Glue42(id="io-connect", children=[
# A component which will invoke the "Sum" Interop method.
dash_glue42.MethodInvoke(id="io-connect-invoke-sum"),
# A component which will invoke the "SendMessage" Interop method.
dash_glue42.MethodInvoke(id="io-connect-invoke-send-message"),
html.Div([
dcc.Input(id="number-a", type="text",
autoComplete="off", value=37),
dcc.Input(id="number-b", type="text",
autoComplete="off", value=5),
html.Button(id="sum-numbers-btn", children="Sum"),
]),
html.P(id="sum-numbers-result"),
html.Hr(),
html.Div(
[
html.Label("Message: "),
dcc.Input(id="message", type="text", autoComplete="off",
value="Send your daily report!"),
html.Button(id="send-message", children="Send")
]
)
])
# Callback that will trigger "Sum" invocation.
@app.callback(
Output("io-connect-invoke-sum", "invoke"),
Input("sum-numbers-btn", "n_clicks"),
State("number-a", "value"),
State("number-b", "value"),
prevent_initial_call=True
)
def sum_numbers(_, a, b):
return {
"definition": {
"name": "Sum"
},
"argumentObj": {
"a": a,
"b": b
}
}
```
--------------------------------
### Startup Extensibility Point
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
Configure the installer's startup behavior, including uninstallation, unattended installations, and custom branding elements like licenses, logos, and banners.
```APIDOC
## Startup Extensibility Point
### Description
Configures the installer's startup behavior, allowing for uninstallation, unattended installations, and customization of license, logo, and banner elements.
### Method
Not Applicable (Configuration Object)
### Endpoint
Not Applicable (Configuration Object)
### Parameters
#### Startup Items
- **uninstall** (object) - Use to initiate the uninstallation process.
- **unattended** (object) - Provides a continuous, uninterrupted installation process without user interaction.
- **conflictHandling** (string: 'ask' | 'retry') - Optional. Specifies how to handle conflicts. Defaults to 'retry'.
- **retries** (number) - Optional. The number of times to attempt resuming the installation.
- **waitMs** (number) - Optional. Interval in milliseconds between retries.
- **hidden** (object) - Provides the same functionality as 'unattended' but hides the installer UI.
- **license** (object) - Use to specify a custom license file.
- **file** (string) - Required. Path to a local license file.
- **url** (string) - Required. URL pointing to a license file.
- **logo** (object) - Use to specify a custom logo for the installer.
- **file** (string) - Required. Path to a local logo file.
- **url** (string) - Required. URL pointing to a logo file.
- **onClick** (string) - Optional. URL to open when the logo is clicked.
- **banner** (object) - Use to specify a custom banner for the installer.
- **file** (string) - Required. Path to a local banner file.
- **url** (string) - Required. URL pointing to a banner file.
- **onClick** (string) - Optional. URL to open when the banner is clicked.
### Request Example
```json
{
"startup": [
{
"type": "license",
"args": {
"file": "license.json"
}
},
{
"type": "logo",
"args": {
"url": "https://example.com/logo.png",
"onClick": "https://example.com"
}
},
{
"type": "banner",
"args": {
"file": "banner.png",
"onClick": "https://example.com"
}
}
]
}
```
### Response
#### Success Response (200)
Not Applicable (Configuration Object)
#### Response Example
Not Applicable (Configuration Object)
```
--------------------------------
### StartedByInfo Object
Source: https://docs.interop.io/desktop/reference/javascript/app%20management/index
Provides details about how the current app instance was started, including the application name, instance ID, and the method of startup.
```APIDOC
## StartedByInfo Object
### Description
Describes how the current app instance was started and provides details about the app that started it.
### Method
N/A (Object Definition)
### Endpoint
N/A
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **applicationName** (string) - Name of the app that started the current app instance.
- **instanceID** (string) - ID of the app instance that started the current app instance.
- **startedBy** ("application" | "intent" | "autoStart") - Indicates how the current app instance was started. Apps can be started by other apps, by a raised Intent, or can be auto started by the system.
#### Response Example
```json
{
"applicationName": "ExampleApp",
"instanceID": "exampleAppInstance123",
"startedBy": "application"
}
```
```
--------------------------------
### Initialize Browser Client App
Source: https://docs.interop.io/browser/getting-started/quick-start/index
Initializes the @interopio/browser library using the IOBrowser() factory function. This sets up the browser client application.
```javascript
const io = await IOBrowser();
console.log(`io.Connect initialized successfully! io.Connect version: ${io.version}`);
```
--------------------------------
### Default Global Layout Management
Source: https://docs.interop.io/browser/capabilities/windows/layouts/layouts-api/index
Provides methods to get, set, and clear the default Global Layout that is automatically loaded on application start.
```APIDOC
## Default Global Layout
### Description
Manage the default Global Layout that loads automatically when the application starts.
### Get Default Global Layout
#### Method
`io.layouts.getDefaultGlobal()`
#### Response
- **defaultLayout** (string | undefined) - The name of the default Global Layout, or `undefined` if none is set.
#### Request Example
```javascript
const defaultLayout = await io.layouts.getDefaultGlobal();
```
### Set Default Global Layout
#### Method
`io.layouts.setDefaultGlobal(layoutName)`
#### Parameters
- **layoutName** (string) - Required - The name of the Global Layout to set as default.
#### Request Example
```javascript
io.layouts.setDefaultGlobal("My Layout");
```
### Clear Default Global Layout
#### Method
`io.layouts.clearDefaultGlobal()`
#### Request Example
```javascript
io.layouts.clearDefaultGlobal();
```
```
--------------------------------
### System Configuration File Example (JSON)
Source: https://docs.interop.io/desktop/developers/configuration/system/index
Example of a system configuration file (`system-PROD-EMEA.json`) for a specific environment ('PROD') and region ('EMEA'). This file overrides settings from the base `system.json`, such as app store configurations. The io.Connect Gateway port is not specified here, assuming it's set to 0 in the base configuration to allow dynamic port assignment.
```json
{
"env": "PROD",
"region": "EMEA",
"appStores": [
{
"type": "rest",
"details": {
"url": "https://my-domain.com/my-app-store",
"auth": "no-auth",
"pollInterval": 30000,
"enablePersistentCache": true,
"cacheFolder": "%LocalAppData%/interop.io/io.Connect Desktop/UserData/%IO_CD_ENV%-%IO_CD_REGION%/configCache/"
}
}
]
}
```
--------------------------------
### Set System Folder Settings for Extensible Installer
Source: https://docs.interop.io/desktop/getting-started/changelog/9-4/index
Sets the locations for the Windows "Desktop" and "Start Menu" folders when repackaging the io.Connect Desktop installer. This uses the `context` extensibility point with `setValue` operations to define the target paths.
```json
{
"context": [
{
"type": "setValue",
"args": {
"name": "DesktopFolder",
"value": "%Public%/Desktop"
}
},
{
"type": "setValue",
"args": {
"name": "StartMenuFolder",
"value": "%ProgramData%/Microsoft/Windows/Start Menu/Programs/io.Connect Desktop"
}
}
]
}
```
--------------------------------
### Starting Apps
Source: https://docs.interop.io/desktop/capabilities/more/features/index
To start an interop-enabled app, use the `app` protocol option and pass the app name. You can pass `ApplicationStartOptions` and context properties using `?` and `&`.
```APIDOC
## Starting Apps
### Description
To start an interop-enabled app, use the `app` protocol option and pass the app name.
To pass `ApplicationStartOptions` when starting an interop-enabled app, use `?` after the app identifier and `&` before each option.
To pass context when starting an interop-enabled app, use `context`.
### Endpoint
`ioconnect://app/[?options][&context.=]`
### Request Example
```
ioconnect://app/clientlist
```
```
ioconnect://app/clientlist?left=100&top=100
```
```
ioconnect://app/clientlist?context.client.id=42
```
```
--------------------------------
### Example Proxy Logging Facade Implementation using log4net
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/net/index
This code provides an example implementation of a proxy logging facade (`ProxyLoggingFacade`) that adheres to the `IDotLoggingFacade` interface. It leverages the standard log4net library for logging operations and includes methods for getting loggers, log folders, and log file names.
```csharp
public class ProxyLoggingFacade : IDotLoggingFacade
{
public IDotLog GetLogger(string loggerName)
{
return new DotLog(loggerName);
}
public List GetLogFolders()
{
// ensure repo is initialized
var logger = GetLogger(GetType().FullName);
var fileAppenders = GetFileAppenders();
var dirs = new HashSet(fileAppenders.Select(fa => Path.GetDirectoryName(fa.File)));
return dirs.ToList();
}
public List GetLogFileNames()
{
// ensure repo is initialized
var logger = GetLogger(GetType().FullName);
var fileAppenders = GetFileAppenders();
var files = new HashSet(fileAppenders.Select(fa => fa.File));
return files.ToList();
}
private static IEnumerable GetFileAppenders()
{
var repository = LogManager.GetRepository();
var fileAppenders =
repository.GetAppenders().Where(iAppender => iAppender is FileAppender).Cast();
return fileAppenders;
}
private class DotLog : IDotLog
{
static DotLog()
{
DeclaringType = typeof(DotLog);
}
public DotLog(string loggerName)
{
Log4NetLogger = LogManager.GetLogger(loggerName);
}
internal DotLog(ILog log4NetLogger)
{
Log4NetLogger = log4NetLogger;
}
private static Type DeclaringType { get; }
private ILog Log4NetLogger { get; }
public bool IsEnabled(DotLogLevel logLevel)
{
return Log4NetLogger.Logger.IsEnabledFor(GetLevel(logLevel));
}
public void Log(DotLogLevel logLevel, object message)
{
Log4NetLogger.Logger.Log(DeclaringType, GetLevel(logLevel), message, null);
}
public void Log(
DotLogLevel logLevel,
object message,
Exception exception)
{
Log4NetLogger.Logger.Log(DeclaringType, GetLevel(logLevel), message, exception);
}
public void FlushBuffers()
{
ILoggerRepository rep = LogManager.GetRepository();
foreach (IAppender appender in rep.GetAppenders())
{
if (appender is BufferingAppenderSkeleton buffered)
{
buffered.Flush();
}
}
}
public bool IsTraceEnabled => Log4NetLogger.Logger.IsEnabledFor(Level.Trace);
public bool IsDebugEnabled => Log4NetLogger.IsDebugEnabled;
public bool IsInfoEnabled => Log4NetLogger.IsInfoEnabled;
public bool IsWarnEnabled => Log4NetLogger.IsWarnEnabled;
public bool IsErrorEnabled => Log4NetLogger.IsErrorEnabled;
public bool IsFatalEnabled => Log4NetLogger.IsFatalEnabled;
public DotLogLevel SetLogLevel(DotLogLevel logLevel)
{
var logger = (Logger)Log4NetLogger.Logger;
var oldLevel = logger.Level;
logger.Level = GetLevel(logLevel);
return GetLevel(oldLevel);
}
private static DotLogLevel GetLevel(Level logLevel)
{
if (logLevel == Level.All)
{
return DotLogLevel.All;
}
if (logLevel == Level.Trace)
{
return DotLogLevel.Trace;
}
if (logLevel == Level.Debug)
{
return DotLogLevel.Debug;
}
if (logLevel == Level.Info)
{
return DotLogLevel.Info;
}
if (logLevel == Level.Warn)
{
return DotLogLevel.Warn;
}
if (logLevel == Level.Error)
{
return DotLogLevel.Error;
}
if (logLevel == Level.Fatal)
{
return DotLogLevel.Fatal;
}
return DotLogLevel.Off;
}
}
}
```
--------------------------------
### Include Browser Client Library
Source: https://docs.interop.io/browser/getting-started/quick-start/index
References the @interopio/browser library and the project's index.js file in the browser client's index.html. This is required for the client application.
```html
```
--------------------------------
### Start App Instance (TypeScript)
Source: https://docs.interop.io/desktop/reference/javascript/apps/index
Starts a new application instance. Requires a StartAppOptions object to configure the new instance. Returns a Promise that resolves with the newly created ApplicationInstance object.
```typescript
import { StartAppOptions, ApplicationInstance } from "@interop/core";
async function startAppInstance(options: StartAppOptions): Promise {
// Implementation details for starting app instance
console.log(`Starting app instance with options:`, options);
return {} as ApplicationInstance; // Placeholder
}
```
--------------------------------
### Set Installer Logo and Click Action (JSON)
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
Configure the installer's top-left logo and its associated click action using the 'startup' extensibility point. The 'logo' type allows specifying the image file and a URL to navigate to when the logo is clicked.
```json
Copy{
"startup": [
{
"type": "logo",
"args": {
"file": "logo.png",
"onClick": "https://example.com"
}
}
]
}
```
--------------------------------
### Initialize Browser Platform Main App
Source: https://docs.interop.io/browser/getting-started/quick-start/index
Initializes the @interopio/browser-platform library using the IOBrowserPlatform() factory function with a license key. This sets up the main application environment.
```javascript
const config = {
licenseKey: "my-license-key"
};
const { io } = await IOBrowserPlatform(config);
console.log(`io.Connect initialized successfully! io.Connect version: ${io.version}`);
```
--------------------------------
### Configure io.Connect Desktop Connection Settings
Source: https://docs.interop.io/browser/capabilities/desktop/index
This snippet demonstrates how to initialize the `@interopio/browser-platform` library with specific connection settings for io.Connect Desktop. It includes options for authentication, discovery interval, forcing incomplete switches, and the preferred connection URL. The configuration is essential for establishing a connection to the io.Connect Gateway.
```javascript
import IOBrowserPlatform from "@interopio/browser-platform";
const config = {
licenseKey: "my-license-key",
connection: {
preferred: {
url: "ws://localhost:8385",
auth:{
username: "user",
password: "password"
},
forceIncompleteSwitch: true,
discoveryIntervalMS: 60000
}
}
};
const { io } = await IOBrowserPlatform(config);
```
--------------------------------
### Create IOConnectStore Service in Angular
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/angular/index
Demonstrates how to create and inject the IOConnectStore service into an Angular component or service. This service is essential for accessing the io.Connect API and managing its initialization.
```typescript
import { Injectable } from "@angular/core";
import { IOConnectStore } from "@interopio/ng";
@Injectable()
export class IOConnectService {
constructor(private readonly ioConnectStore: IOConnectStore) { }
};
```
--------------------------------
### Include Browser Platform Library
Source: https://docs.interop.io/browser/getting-started/quick-start/index
References the @interopio/browser-platform library and the project's index.js file in the main app's index.html. This is essential for the main application to function.
```html
```
--------------------------------
### Start App Instance
Source: https://docs.interop.io/desktop/reference/javascript/apps/index
Starts a new application instance or reuses an existing one based on the provided options.
```APIDOC
## POST /websites/interop_io/start
### Description
Starts an app instance.
### Method
POST
### Endpoint
/websites/interop_io/start
### Parameters
#### Request Body
- **options** (StartAppOptions) - Required - Options for starting the app instance.
### Request Example
```json
{
"options": {
"name": "my-app",
"reuseInstance": true,
"timeout": 60000,
"context": {
"key": "value"
},
"definitionOverride": {
"version": "1.0.0"
}
}
}
```
### Response
#### Success Response (200)
- **instance** (ApplicationInstance) - The started application instance.
#### Response Example
```json
{
"instance": {
"id": "instance-123",
"name": "my-app",
"state": "RUNNING"
}
}
```
```
--------------------------------
### Target Specific Apps for Method Invocation (VBA)
Source: https://docs.interop.io/desktop/capabilities/data-sharing/interop/vba/index
Shows how to use the targetRegex and all parameters of InvokeAsync to specify which servers should receive the method invocation. This example targets all apps with names starting with 'clients'.
```VBA
Public Sub InvokeMethod()
...
MyMethodProxy.InvokeAsync "MyVBAMethod", "clients.*", Args, True, "", 3000
...
End Sub
```
--------------------------------
### Start New React App
Source: https://docs.interop.io/browser/tutorials/react/index
Starts the newly created and configured React application from its root directory.
```bash
npm start
```
--------------------------------
### Initialize IOConnectNg with Desktop Factory (Angular 14-)
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/angular/index
Demonstrates how to import the `IOConnectNg` module in the root module for Angular versions 14 and below. It configures the module with the desktop factory for io.Connect.
```typescript
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { AppComponent } from "./app.component";
import { IOConnectNg } from "@interopio/ng";
import IODesktop from "@interopio/desktop";
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
IOConnectNg.forRoot({ desktop: { factory: IODesktop } })
],
providers: [],
bootstrap: [AppComponent]
});
export class AppModule { };
```
--------------------------------
### Bootstrap Application with IOConnectNg (Angular 15+)
Source: https://docs.interop.io/desktop/getting-started/how-to/interop-enable-your-apps/angular/index
Illustrates the `main.ts` file configuration for bootstrapping an Angular application using `bootstrapApplication` with the previously configured `appConfig` for Angular 15 and later.
```typescript
import { bootstrapApplication } from "@angular/platform-browser";
import { appConfig } from "./app/app.config";
import { AppComponent } from "./app/app.component";
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));
```
--------------------------------
### Initialize io.Manager with License Key (JavaScript)
Source: https://docs.interop.io/manager/requirements/index
Demonstrates how to initialize the io.Manager server by passing the license key directly within the configuration object. This method is suitable for direct integration within your application's startup logic.
```javascript
import { start } from "@interopio/manager";
const config = {
licenseKey: "my-license-key"
};
const server = await start(config);
```
--------------------------------
### Starting an App with io.Connect
Source: https://docs.interop.io/desktop/capabilities/more/features/index
To launch an interop-enabled app, use the `app` protocol option followed by the app name. Options and context can be passed using query parameters.
```text
ioconnect://app/clientlist
```
```text
ioconnect://app/clientlist?left=100&top=100
```
```text
ioconnect://app/clientlist?context.client.id=42
```
--------------------------------
### Open Browser Client from Main App
Source: https://docs.interop.io/browser/getting-started/quick-start/index
Demonstrates how to open a Browser Client from the Main app using the Window Management API. It requires the Main app to be initialized first.
```javascript
// In index.js of the Main app.
const config = {
licenseKey: "my-license-key"
};
const { io } = await IOBrowserPlatform(config);
console.log(`io.Connect initialized successfully! io.Connect version: ${io.version}`);
const name = "My Browser Client";
const url = "https://example.com";
// Opening the Browser Client from the Main app.
const myWin = await io.windows.open(name, url);
```
--------------------------------
### Get io.Connect Window Zoom Factor
Source: https://docs.interop.io/browser/capabilities/windows/window-management/index
Retrieves the current zoom factor of an io.Connect Window via the `zoomFactor` property. This is available starting from io.Connect Browser version 4.1.
```javascript
const zoomFactor = myWindow.zoomFactor;
```
--------------------------------
### Execute Scripts During Installation - JSON
Source: https://docs.interop.io/desktop/getting-started/how-to/rebrand-io-connect/installer/index
This JSON configuration illustrates how to execute external scripts during the io.Connect installation process using the 'run' type within extensibility points like 'welcome'. It specifies the program to run, its arguments, and how to handle exit codes.
```json
{
"welcome": [
{
"type": "run",
"args": {
"filename": "cmd.exe",
"args": "/c copy-resources.bat",
"exitCode1": "Error validating the installation.",
"exitCode3": "success",
"hide": true,
"hideInstaller": false
}
}
]
}
```