Avalonia UI on Endpoint Domino

Avalonia UI is a great UI development tool…and it works with Endpoint Domino.

Of course I have to make a video, music and all, just to show it off… :wink:

7 Likes

Visually design your GUI inside Visual Studio using XAML, then deploy it to the hardware.

4 Likes

image

3 Likes

avalonia :heart: SkiaSharp :heart: endpoint

2 Likes

Even Silverlight (OpenSilver) is back. XAML returns from the grave! I knew all that time I spent learning it would not go to waste :slight_smile:

3 Likes

His sample project can be found here:

endpoint-samples/dotnet/AvaloniaTouch at master · ghi-electronics/endpoint-samples (github.com)

1 Like

All right, we need a video about how you got it to run on EndPoint.

EDIT: Perhaps I should have read the instructions.

Alright, I read the instructions, and now I’m stumped. It keeps trying to run on Windows even though I select the EndPoint debugger.

Edit: It keeps saying unknown target framework.

Do you have Resharper installed ?

No I do not have ReSharper

Sigh. The thing requires an input device to work at all!

using Avalonia;
using GHIElectronics.Endpoint.Core;
using GHIElectronics.Endpoint.Devices.Display;
using GHIElectronics.Endpoint.Drivers.Avalonia.Input;
using GHIElectronics.Endpoint.Drivers.FocalTech.FT5xx6;
using System.Device.Gpio;
using System.Device.Gpio.Drivers;

namespace EndPointPS01.Services
{
    public class AvaloniaUIService : BackgroundService
    {

        const int screenWidth = 800;
        const int screenHeight = 480;

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var backlightPort = EPM815.Gpio.Pin.PD14 / 16;
            var backlightPin = EPM815.Gpio.Pin.PD14 % 16;
            var backlightDriver = new LibGpiodDriver(backlightPort);
            var backlightController = new GpioController(PinNumberingScheme.Logical, backlightDriver);
            backlightController.OpenPin(backlightPin);
            backlightController.SetPinMode(backlightPin, PinMode.Output);
            backlightController.Write(backlightPin, PinValue.High);

            var configuration = new FBDisplay.Configuration()
            {
                Clock = 30000,
                Width = screenWidth,
                Hsync_start = screenWidth + 2,
                Hsync_end = screenWidth + 2 + 41,
                Htotal = screenWidth + 2 + 41 + 2,
                Height = screenHeight,
                Vsync_start = screenHeight + 2,
                Vsync_end = screenHeight + 2 + 10,
                Vtotal = screenHeight + 2 + 10 + 2,
            };
            var fbDisplay = new FBDisplay(configuration);
            var displayController = new DisplayController(fbDisplay);

            EPM815.I2c.Initialize(EPM815.I2c.I2c6);

            var touch = new FT5xx6Controller(EPM815.I2c.I2c6, EPM815.Gpio.Pin.PF12);

            var input = new InputDevice();
            input.EnableOnscreenKeyboard(displayController);

            var builder = BuildAvaloniaApp();


            builder.StartLinuxFbDev(new string[] { "--fbdev" }, "/dev/fb0", 1, input);
        }

        public static AppBuilder BuildAvaloniaApp()
    => AppBuilder.Configure<AvaloniaTouch.App>()
        .UsePlatformDetect()
        .WithInterFont();
    }
}

That last line of the Execute Async Method requires an input object, it crashes if you pass null.

builder.StartLinuxFbDev(new string[] { "--fbdev" }, "/dev/fb0", 1, input);// <- input is required even if it isn't being used.

(Context, I added Avalonia to my existing Blazor Server side Endpoint project)