Giter Site home page Giter Site logo

ahmetkocadogan / blazetron Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mandrepont/blazetron

0.0 1.0 0.0 198 KB

Simple starter application for Blazor + Electron using Blazor and Electron.NET

License: MIT License

C# 41.52% CSS 19.60% HTML 38.88%

blazetron's Introduction

please check out the orginal post on Cooldown.io

Getting started with Blazor and Electron.NET

Background Information:

  • What is Blazor?
    • From the Blazor Github, Blazor is a .NET web framework using C#/Razor and HTML that runs in the browser with WebAssembly."
  • What is Electron.NET?
    • From the Electron.NET Github, "Electron.NET is a wrapper around a "normal" Electron application with an embedded ASP.NET Core application".

Perquisites:

  • So that this article does not get dated with irreverent information quickly I will be using information from other resources.
  • getting started for blazor 
  • node.js v8.6.0+
  • electron-packager --global

Sample Project Github:

  • If you do not want to follow the steps below, or just want to check out the code I reproduced the following steps in a repo. Besure you all the required perquisites 

Setting up a simple project:

  1. If you have not done so, check out the getting started for blazor to install perquisites for this tutorial 
  2. Create a new Blazor (ASP.NET Core hosted) project
  3. Install ElectronNET.API
PM> Install-Package ElectronNET.API
  1. In %projectname%.Server/Program.cs change BuildWebHost to use Electron
public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseElectron(args)
                .UseStartup<Startup>()
                .Build();
  1. In %projectname%.Server/Startup.cs change Configure to open Electron
app.UseBlazor<Client.Program>();
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
  1. Add cli tooling to %projectname%.Server
<ItemGroup>
    <DotNetCliToolReference  Include="ElectronNET.CLI"  Version="0.0.9"  />         
</ItemGroup>
**Note at the time the current version is 0.0.9**
dotnet restore
  1. Install electron packager
sudo npm install electron-packager --global
  1. Init and Run
dotnet electronize init
dotnet electronize start

Credits:

I claim none of this work as my own and proudly support the work of both the aspnet team on Blazor and the team developing Electron.NET, this post is intended to raise awareness of some of the possibilities for a prototype. Most of the "Setting up a simple project" is directly from both Electron.NET's and Blazor's githubs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.