# Ooui Web Framework [![Build Status](https://www.bitrise.io/app/86585e168136767d/status.svg?token=G9Svvnv_NvG40gcqu48RNQ)](https://www.bitrise.io/app/86585e168136767d) | Version | Package | Description | | ------- | ------- | ----------- | | [![NuGet Package](https://img.shields.io/nuget/v/Ooui.svg)](https://www.nuget.org/packages/Ooui) | [Ooui](https://www.nuget.org/packages/Ooui) | Core library with HTML elements and a server | | [![NuGet Package](https://img.shields.io/nuget/v/Ooui.AspNetCore.svg)](https://www.nuget.org/packages/Ooui.AspNetCore) | [Ooui.AspNetCore](https://www.nuget.org/packages/Ooui.AspNetCore) | Integration with ASP.NET Core | | [![NuGet Package](https://img.shields.io/nuget/v/Ooui.Forms.svg)](https://www.nuget.org/packages/Ooui.Forms) | [Ooui.Forms](https://www.nuget.org/packages/Ooui.Forms) | Xamarin.Forms backend using Ooui | | [![NuGet Package](https://img.shields.io/nuget/v/Ooui.Wasm.svg)](https://www.nuget.org/packages/Ooui.Wasm) | [Ooui.Wasm](https://www.nuget.org/packages/Ooui.Wasm) | Package your app into a web assembly | Ooui (pronounced *weee!*) is a small cross-platform UI library for .NET that uses web technologies. It presents a classic object-oriented UI API that controls a dumb browser. With Ooui, you get the full power of your favorite .NET programming language *plus* the ability to interact with your app using any device. ## Try it Online Head on over to [http://ooui.mecha.parts](http://ooui.mecha.parts) to tryout the samples. You can also load [https://s3.amazonaws.com/praeclarum.org/wasm/ooui-sample.html](https://s3.amazonaws.com/praeclarum.org/wasm/ooui-sample.html) to try the WebAssembly mode of Ooui running Xamarin.Forms. (That's Xamarin.Forms running right in your browser!) ## Try the Samples Locally ```bash git clone git@github.com:praeclarum/Ooui.git cd Ooui dotnet restore msbuild dotnet run --project Samples/Samples.csproj --no-build ``` *(There is currently an issue with Xamarin.Forms and building from the dotnet cli, so for now we use the msbuild command and then set the --no-build flag on dotnet run but this will eventually change when the issue is resolved.)* This will open the default starting page for the Samples. Now point your browser at [http://localhost:8080/shared-button](http://localhost:8080/shared-button) You should see a button that tracks the number of times it was clicked. The source code for that button is shown in the example below. ## Example App Here is the complete source code to a fully collaborative button clicking app. ```csharp using System; using Ooui; class Program { static void Main(string[] args) { // Create the UI var button = new Button("Click me!"); // Add some logic to it var count = 0; button.Click += (s, e) => { count++; button.Text = $"Clicked {count} times"; }; // Publishing makes an object available at a given URL // The user should be directed to http://localhost:8080/shared-button UI.Publish ("/shared-button", button); // Don't exit the app until someone hits return Console.ReadLine (); } } ``` Make sure to add a reference to Ooui before you start running! ```bash dotnet add package Ooui dotnet run ``` With just that code, a web server that serves the HTML and web socket logic necessary for an interactive button will start. ## The Many Ways to Ooui Ooui has been broken up into several packages to increase the variety of ways that it can be used. Here are some combinations to help you decide which way is best for you.
Ooui | Ooui.AspNetCore | Ooui.Forms | Ooui.Wasm | |
---|---|---|---|---|
✓ | Web DOM with the built-in web server | |||
✓ | ✓ | Web DOM with ASP.NET Core | ||
✓ | ✓ | ✓ | Xamarin.Forms with ASP.NET Core | |
✓ | ✓ | Xamarin.Forms with the built-in web server | ||
✓ | ✓ | Web DOM with Web Assembly | ||
✓ | ✓ | ✓ | Xamarin.Forms with Web Assembly |