Popularity
2.1
-
Activity
8.2
-
61
5
3

Programming language: C#
Tags: GUI    

Lara alternatives and similar packages

Based on the "GUI" category

Do you think we are missing an alternative of Lara or a related project?

Add another 'GUI' Package

README

Lara Web Engine License: Apache 2.0 NuGet version Download count Build Status Coverage Status

Lara is a library for developing web user interfaces. Lara gives you full control of the client's HTML Document Object Model (DOM) from the server in C#, and avoids page refreshes by exchanging differentials between server and client.

"It is similar to server-side Blazor, but is much more lightweight and easier to install. For example, while any type of Blazor requires a whole SDK, Lara is just a NuGet package." ScientificProgrammer.net

Sample application

using Integrative.Lara;
using System.Threading.Tasks;

namespace SampleProject
{
    class Program
    {
        static async Task Main()
        {
            using var app = new Application();
            await app.Start(new StartServerOptions
            {
                Port = 8182,

                // looks for classes decorated with 'Lara' attributes
                PublishAssembliesOnStart = true
            });
            await app.WaitForShutdown();
        }
    }

    [LaraPage(Address = "/")]
    class MyPage : IPage
    {
        int counter = 0;

        public Task OnGet()
        {
            var button = Element.Create("button");
            button.InnerText = "Click me";
            button.On("click", () =>
            {
                counter++;
                button.InnerText = $"Clicked {counter} times";
                return Task.CompletedTask;
            });
            LaraUI.Page.Document.Body.AppendChild(button);
            return Task.CompletedTask;
        }
    }
}

Other resources available for building web pages are the LaraBuilder class, Web Components, and Reactive Programming.

Integrating Lara into an existing web server

To add Lara to an existing ASP.NET Core server, add to the Startup class or equivalent:

private readonly Application _laraApp = new Application();

public void Configure(IApplicationBuilder app)  
{  
    app.UseLara(_laraApp, new LaraOptions
    {
        // configuration options
    });
} 

Creating Desktop applications

To create a desktop container for your web app, here's a few options:

Getting started

There's no need to download this repository to use Lara, instead, there's a NuGet package.

To start, create a new project and add the NuGet package Integrative.Lara. In Visual Studio go to Tools -> NuGet Package Manager -> Manage NuGet packages for Solution, then search for the package 'Integrative.Lara'.

In your project, copy and paste the sample application.

This repository contains a sample project.

The wiki has the documentation for using Lara.

How does Lara work?

Whenever the browser triggers a registered event (e.g. click on a button), it sends to the server a message saying that the button was clicked. The server executes the code associated with the event, manipulating the server's copy of the page, and replies a JSON message with the delta between server and client.

The source code contains a sample project. The documentation is available in the wiki.

How to contribute

Please send feedback! Issues, questions, suggestions, requests for features, and success stories. Please let me know by either opening an issue or by direct message. Thank you!

If you like Lara, please give it a star - it helps!

Credits

Thanks to JetBrains for the licenses of Rider and DotCover.

[JetBrains](support/jetbrains.svg)


*Note that all licence references and agreements mentioned in the Lara README section above are relevant to that project's source code only.