Many industrial devices have a touch screen and a Linux board: operator panels, kiosks, measuring instruments. Avalonia can draw the interface directly on the screen, without a desktop environment, keeping C# and XAML.
Starting without a desktop
The Linux framebuffer package lets the application start by drawing directly through DRM or the framebuffer, with touch screen input.
public static class Program
{
public static int Main(string[] args)
{
var builder = BuildAvaloniaApp();
// on the panel: no desktop, draw straight to the screen
if (args.Contains("--drm"))
return builder.StartLinuxDrm(args);
// on the development PC: a normal window
return builder.StartWithClassicDesktopLifetime(args);
}
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace();
}
The same project runs in a window on the developer's PC and full screen on the device: you develop and test comfortably, and deploy on the board.
Publishing for ARM
dotnet publish -c Release -r linux-arm64 --self-contained true -p:PublishAot=true
With Native AOT the application starts quickly even on modest processors and does not need the .NET runtime installed on the board.
Designing for the field
- Touch: large buttons, no interactions that require hovering.
- Readability: high contrast and large fonts, because shop-floor lighting is unpredictable.
- Robustness: automatic start as a system service and restart on error.
- Updates: a secure remote update mechanism, designed in from the start.
Combined with industrial protocols such as OPC UA and Modbus, Avalonia makes it possible to build modern machine interfaces with the same skills used for business applications.
Comments (0)
No comments yet.