Skip to content

.NET/C# Wrapper for the WebUI browser based GUI library

License

Notifications You must be signed in to change notification settings

Juff-Ma/WebUI.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

WebUI.NET

WebUI is a minimal GUI library that uses a Browser already installed instead of bundling a large browser engine or requiring support for a native WebView.

This library contains high level bindings and precompiled binaries for the native WebUI library.

Features

  • Portable (Needs only a web browser and .NET at runtime)
  • Fast binary communication protocol
  • Multi-platform & Multi-Browser
  • Using private profile for safety

Screenshots

If you want to see whats possible here are screenshots of the text_editor example (originally ported from the C version) on Windows, MacOS and Linux (Gnome)

More Info

If you are not yet convinced or need more informations about WebUI take a look at it's homepage or it's repository

Contents

Installation

You can install WebUI.NET using nuget by using the nuget explorer or the following command:

dotnet add package WebUI.NET

In addition, to use prebuild versions of WebUI you'll need to download WebUI.NET.Natives

dotnet add package WebUI.NET.Natives

or the secure natives (OpenSSL support)

dotnet add package WebUI.NET.Natives.Secure

Debug builds

The debug builds of WebUI.NET are provided using github packages and contain debug builds of the library and the underlying natives. WebUI will ONLY provide debug logging on such builds. If you did install the nuget.org variant first you might need to clear your nuget cache and bin/obj directories in order for nuget to download and use those builds.

Usage

A basic example (.NET 7.0+) of how to open a Window and display a basic message (taken from basic_window example)

using WebUI;

Window window = new();
window.Show("""
<html>
    <script src="webui.js"></script> 
    <head>
        <title>WebUI</title>
    </head>
    <body>
        <h1>WebUI</h1>
        <p>It works!</p>
    </body>
</html>
""");

Utils.WaitForExit();

For more examples you can look at the examples directory.

Deployment Options

If you finished writing your app and now want to ship it to your users you have multiple options, of course you can package the app in whatever way you want but here are some tested recommendations. For Windows and Linux deployment take a look at PupNet-Deploy and for MacOS you can write a little startup bash script and then use Platypus and create-dmg to build the package.

Building

You can build WebUI.NET itself like every other .NET project by using dotnet build. When buildung the .nupkg and .snupkg are put into the repective configuration's directory inside the nupkgs toplevel directory.

In contrast the examples require the library and natives provided by WebUI.NET and WebUI.NET.Natives. Because of a limitation of .NET natives can only be provided by a nuget package and not a package reference. The examples take the nuget binaries from the nupkgs directory, this leads to some problems while development (like requiring to clear the nuget cache every now and then). For you this will mean that if you want to build the examples or the full solution you will need to build the WebUI.NET and WebUI.NET.Natives packages at least once so they provide those packages locally.

Licensing

WebUI.NET is licensed under the MPL-2.0 license, more information about dos and don'ts can be found on the Mozilla MPL FAQ but in short you can use this library in binary form in proprietary and open-source projects as long as you keep the copyright and tell people where to download the library. If you want to include the library in source code form you will need to keep every file that contains MPL code under the MPL. Notable exception are the LGPL2.1+ GPL2+ or AGPL3+ licenses that the MPL also allows you to use. DISCLAIMER: I'm not a lawyer and this is not legal advice, if you want more specific info please read the FAQ and the license
The examples are NOT part of the main project and can be used under the CC0 license for that matter as long as you respect the license of this library and the other libraries used by this project.

WebUI and its logo (on which the WebUI.NET logo is based) are licensed under the MIT license.

All libraries used in this projects are under Copyright (C) of their respective owners. You can find more information on the copyright notice of the WebUI.NET.Natives and WebUI.NET.Natives.Secure nuget packages.

Alternatives

If you want a library that is not licensed under MPL but rather MIT and has similar functionality consider checking out WebUI4CSharp