CarloSharp 1.0.7

Web rendering surface for .NET applications

Install-Package CarloSharp -Version 1.0.7
dotnet add package CarloSharp --version 1.0.7
<PackageReference Include="CarloSharp" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CarloSharp --version 1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Carlo#

Web rendering surface for .NET applications.

This is a port of the Google Carlo project (<https://github.com/GoogleChromeLabs/carlo>) to .NET

Nuget package

Nuget page: <https://www.nuget.org/packages/CarloSharp/1.0.4>

Adding the package using Package Manager:

Install-Package CarloSharp -Version 1.0.4

Adding the package using .Net CLI:

dotnet add package CarloSharp --version 1.0.4

Requirements

.NET Core SDK 2.1+ (<https://www.microsoft.com/net/learn/get-started/windows>)

For the Angular and React samples Node JS (<https://nodejs.org/en/)> is also required.

Building and running the Angular sample

To run the Angular sample application you must first restore the Angular NPM dependencies.

Open a terminal at Samples/Angular/wwwroot and execute:
npm install

After this step you can build and run the project using:
dotnet run

![alt text](Samples/LinuxAngular01.png "Carlo# Running Angular sample on Linux")


using CarloSharp.Samples.Angular.Controllers;
using System;
using System.Threading;

namespace CarloSharp.Samples.Angular
{
    public class Program
    {
        private static ManualResetEvent _exitEvent = new ManualResetEvent(false);

        public static void Main(string[] args)
        {
            var app = Carlo.Launch(new Options()
            {
                Title = "Carlo# - Angular",
                Width = 1024,
                Height = 600,
                Channel = new string[] { "stable" }
            });

            var controller = new WeatherForecastController(app.MainWindow);

            app.ServeFolder("./wwwroot/dist");

            app.Load("index.html");

            app.Exit += OnAppExit;

            _exitEvent.WaitOne();
        }

        private static void OnAppExit(object sender, EventArgs args)
        {
            _exitEvent.Set();
        }
    }
}
using CarloSharp.Samples.Angular.Model;
using System;
using System.Linq;

namespace CarloSharp.Samples.Angular.Controllers
{
    public class WeatherForecastController
    {
        class WeatherForecastArgs
        {
            public string City { get; set; }

            public bool UseCelsius { get; set; }
        }

        private static string[] Summaries = new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };

        public WeatherForecastController(Window window)
        {
            window.IpcMessageReceived += OnIpcMessageReceived;
        }

        private void OnIpcMessageReceived(object sender, IpcMessageEventArgs e)
        {
            if (e.Channel == "getWeatherForecasts")
            {
                var args = e.Message.ToObject<WeatherForecastArgs>();

                e.Result = GetWeatherForecasts(args.City, args.UseCelsius);
            }
        }

        private WeatherForecast[] GetWeatherForecasts(string city, bool useCelsius)
        {
            var random = new Random();

            return Enumerable.Range(1, 5).Select(index =>
                new WeatherForecast
                {
                    DateFormatted = DateTime.Now.AddDays(index).ToString("d"),
                    TemperatureC = random.Next(-20, 55),
                    Summary = Summaries[random.Next(Summaries.Length)]
                }).ToArray();
        }
    }
}
import { Component } from '@angular/core';

interface Ipc {
  sendSync(channel : string, message : any) : any;
}

declare global {
  interface Window { ipc: Ipc; }
}

@Component({
  selector: 'app-fetch-data',
  templateUrl: './fetch-data.component.html'
})
export class FetchDataComponent {
  public forecasts: WeatherForecast[];

  constructor() {
    this.loadAsync();
  }

  async loadAsync() {
    this.forecasts = await window.ipc.sendSync('getWeatherForecasts', { City: 'New York', UseCelsius: true });
  }
}

interface WeatherForecast {
  dateFormatted: string;
  temperatureC: number;
  temperatureF: number;
  summary: string;
}

Carlo#

Web rendering surface for .NET applications.

This is a port of the Google Carlo project (<https://github.com/GoogleChromeLabs/carlo>) to .NET

Nuget package

Nuget page: <https://www.nuget.org/packages/CarloSharp/1.0.4>

Adding the package using Package Manager:

Install-Package CarloSharp -Version 1.0.4

Adding the package using .Net CLI:

dotnet add package CarloSharp --version 1.0.4

Requirements

.NET Core SDK 2.1+ (<https://www.microsoft.com/net/learn/get-started/windows>)

For the Angular and React samples Node JS (<https://nodejs.org/en/)> is also required.

Building and running the Angular sample

To run the Angular sample application you must first restore the Angular NPM dependencies.

Open a terminal at Samples/Angular/wwwroot and execute:
npm install

After this step you can build and run the project using:
dotnet run

![alt text](Samples/LinuxAngular01.png "Carlo# Running Angular sample on Linux")


using CarloSharp.Samples.Angular.Controllers;
using System;
using System.Threading;

namespace CarloSharp.Samples.Angular
{
    public class Program
    {
        private static ManualResetEvent _exitEvent = new ManualResetEvent(false);

        public static void Main(string[] args)
        {
            var app = Carlo.Launch(new Options()
            {
                Title = "Carlo# - Angular",
                Width = 1024,
                Height = 600,
                Channel = new string[] { "stable" }
            });

            var controller = new WeatherForecastController(app.MainWindow);

            app.ServeFolder("./wwwroot/dist");

            app.Load("index.html");

            app.Exit += OnAppExit;

            _exitEvent.WaitOne();
        }

        private static void OnAppExit(object sender, EventArgs args)
        {
            _exitEvent.Set();
        }
    }
}
using CarloSharp.Samples.Angular.Model;
using System;
using System.Linq;

namespace CarloSharp.Samples.Angular.Controllers
{
    public class WeatherForecastController
    {
        class WeatherForecastArgs
        {
            public string City { get; set; }

            public bool UseCelsius { get; set; }
        }

        private static string[] Summaries = new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };

        public WeatherForecastController(Window window)
        {
            window.IpcMessageReceived += OnIpcMessageReceived;
        }

        private void OnIpcMessageReceived(object sender, IpcMessageEventArgs e)
        {
            if (e.Channel == "getWeatherForecasts")
            {
                var args = e.Message.ToObject<WeatherForecastArgs>();

                e.Result = GetWeatherForecasts(args.City, args.UseCelsius);
            }
        }

        private WeatherForecast[] GetWeatherForecasts(string city, bool useCelsius)
        {
            var random = new Random();

            return Enumerable.Range(1, 5).Select(index =>
                new WeatherForecast
                {
                    DateFormatted = DateTime.Now.AddDays(index).ToString("d"),
                    TemperatureC = random.Next(-20, 55),
                    Summary = Summaries[random.Next(Summaries.Length)]
                }).ToArray();
        }
    }
}
import { Component } from '@angular/core';

interface Ipc {
  sendSync(channel : string, message : any) : any;
}

declare global {
  interface Window { ipc: Ipc; }
}

@Component({
  selector: 'app-fetch-data',
  templateUrl: './fetch-data.component.html'
})
export class FetchDataComponent {
  public forecasts: WeatherForecast[];

  constructor() {
    this.loadAsync();
  }

  async loadAsync() {
    this.forecasts = await window.ipc.sendSync('getWeatherForecasts', { City: 'New York', UseCelsius: true });
  }
}

interface WeatherForecast {
  dateFormatted: string;
  temperatureC: number;
  temperatureF: number;
  summary: string;
}

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.7 136 6/6/2019
1.0.6 125 6/2/2019
1.0.5 171 3/19/2019
1.0.4 105 3/14/2019
1.0.3 105 3/12/2019
1.0.2 116 3/12/2019
1.0.1 103 3/10/2019
1.0.0 102 3/10/2019