
ElectronCGI – A Solution to Cross-Platform GUIs for .NET Core - rdfi
https://www.blinkingcaret.com/2019/11/27/electroncgi-a-solution-to-cross-platform-guis-for-net-core/
======
Goz3rr
The author stating that using a webserver and a full web framework for a
desktop application feels wasteful seems oddly ironic when you follow up by
using a browser and full framework for a desktop application.

------
Hawxy
Steve Sanderson (creator of Blazor) is working on something similar that
doesn't use Electron:

[https://blog.stevensanderson.com/2019/11/01/exploring-
lighte...](https://blog.stevensanderson.com/2019/11/01/exploring-lighter-
alternatives-to-electron-for-hosting-a-blazor-desktop-app/)

From Blazor roadmaps a few months ago, I think the idea is that Blazor will
become the recommended .NET Core cross-platform UI choice sometime after .NET
5.

~~~
rafaelvasco
That is a much better way to go on imo. No Electron and no Node involved. A
tiny crossplatform webview + .net core is much preferable for me.

~~~
bobblywobbles
Check out this page: [https://blog.stevensanderson.com/2019/11/01/exploring-
lighte...](https://blog.stevensanderson.com/2019/11/01/exploring-lighter-
alternatives-to-electron-for-hosting-a-blazor-desktop-app/)

------
injidup
How about Avalonia. [https://avaloniaui.net/](https://avaloniaui.net/) The
assertion that there are no .NET core GUI frameworks and that resorting to the
abomination that is electron is the solution is just false.

Or go full functional with an Elmish architecture using F#, .net core and
Avalonia.

~~~
pjmlp
F# is a niche language among .NET developers, because adopting it closes the
doors to lots of enterprise tooling (including Visual Studio designers), that
only consider VB.NET and C#

~~~
injidup
Visual Studio designers are an abomination. Once beyond anything trivial it is
slow and buggy and a pain. Look at FUNC.UI
[https://github.com/FuncUI/Avalonia.FuncUI](https://github.com/FuncUI/Avalonia.FuncUI)
to see how code only UIs could look.

~~~
pjmlp
I know how code only UIs could work, I've been doing UIs since Turbo Vison for
MS-DOS, and lost count how many toolkits I have used since then.

No designer, I get to move into something else.

The Web being the exception here, as it keeps rebooting itself without ever
learning from native toolkits.

------
blinkingled
I always wonder why Qt5+/Qml/QtQuick have not taken the XP desktop development
by storm. QML is JS like, there's an IDE and KDE seems to have built lot of
good looking desktop software using Kirigami/QtQuick.

It's got to be better than anything Electron for sure.

Anyone know if .NET Core Qt bindings are a technical possibility?

~~~
ubertakter
Two replies mention licensing, with two different answers (It's easy, people
just don't understand! It's hard, people just don't understand!). Personally,
I've tried a couple of times to read the license information on the Qt site
and sort out how the licensing really works. I still only have a rough
understanding. It seems like information on the Qt site is intentionally vague
so you'll be more inclined to buy a commercial license just to feel "safe"
using it. Unfortunately, any commercial projects I work on can't justify the
commercial license price.

Anyway, the point is, people may not want to use Qt without being _absolutely
certain_ about how the licensing works and they (like me) probably don't have
the time to try to understand the poorly organized information on the Qt site.

~~~
jcelerier
> Personally, I've tried a couple of times to read the license information on
> the Qt site and sort out how the licensing really works.

You could just go to the repo and check the licenses there :

[https://github.com/qt/qtbase](https://github.com/qt/qtbase)

------
thesuperbigfrog
This is a great step forward, but it seems like a great deal of overhead and
complexity to have a cross-platform GUI.

If I were creating a new cross-platform desktop application I would probably
reach for Java instead. I know that's not the popular answer, but if a .NET
Core cross-platform GUI requires either using Electron or simulating a client-
server setup with Node then it's not there yet.

To illustrate, here is the "Hello World" cross-platform GUI application in
Java:

[https://docs.oracle.com/javase/tutorial/uiswing/examples/sta...](https://docs.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java)

Setting up a connection between two processes and building async handlers is
_way too much_ if the application is running on one machine.

~~~
efdee
Good luck getting that Swing app to look nice, though. Which is a breeze with
HTML/CSS.

~~~
tannhaeuser
Swing can look fantastic if you put in the effort as IntelliJ (based on Swing)
shows. I'm not necessarily an IDE guy, but good luck with getting that kind of
functionality with JS on Electron even remotely.

~~~
efdee
I wouldn't say IntelliJ's stuff looks -good-. It's a lot more workable than
most Swing apps but it's still a long way from looking "good".

That said I haven't touched their IDEs in 2 years so maybe something changed.

~~~
jen20
I'd say IntelliJ looks like it belongs on the platform it is run on - which
I'll take any day over some over-designed cross-platform 'styling'.

------
tabtab
What's really needed is a standard GUI markup language (SGML) and probably a
dedicated browser, or at least a browser pluggin. Emulating desktop-like GUI's
using JavaScript and DOM has proven clunky and unreliable, largely because
HTML browser makers do what they want when they want. A dedicated GUI browser
wouldn't break GUI's because doing GUI's is its sole purpose.

HTML browser makers usually don't care if they break a particular JavaScript
library by adding or tweaking features. It's a matter of focus. The SGML
browser's only job is to do GUI's right. But HTML browsers have 100's of jobs.
If changes harm a few of those, they become roadkill.

But using JavaScript as the starting point of a SGML may be the only way to
gain momentum. However, the end game should be using mostly markup to manage a
GUI, not JavaScript.

Standard and common GUI idioms and behaviors should be done in a declarative
fashion using such markup, such as having a button open (make visible) a given
window. While some client scripting may be needed, most of the processing
could and should be done at the server if the SGML browser does most of the UI
grunt-work.

~~~
azhenley
I like your idea and Microsoft probably hoped for XAML to become that
standard.

~~~
tabtab
It's fairly close to what I have in mind, but it's also mostly static, I
believe. It would need enhancements to handle interaction and UI updates
better.

And I'm not sure about its cross-platform abilities, but I haven't tested the
limits.

~~~
WorldMaker
> It's fairly close to what I have in mind, but it's also mostly static, I
> believe. It would need enhancements to handle interaction and UI updates
> better.

XAML Behaviors and Storyboards have been around since very early in XAML
history. They aren't fun to write by hand, which is why originally they were a
"Blend thing" focused for Designers mostly (and a lot of the XML namespaces
still have "Blend" or "Expression" keywords in them) and the non-Designer
Developer story for them has always lagged behind, which sometimes seems a
shame because they can also be really powerful.

> And I'm not sure about its cross-platform abilities, but I haven't tested
> the limits.

There was the brief period where Silverlight was very cross-platform. Xamarin
and Uno and Avalonia all seem healthy and to imply that XAML works well cross-
platform.

------
pjmlp
If it uses Electron it is not a solution.

Even Microsoft's own React Native team bashes on Electron's resource usage.

[https://www.youtube.com/watch?v=IUMWFExtDSg](https://www.youtube.com/watch?v=IUMWFExtDSg)

[https://www.youtube.com/watch?v=TZnajQqqKV8](https://www.youtube.com/watch?v=TZnajQqqKV8)

About 160% more resource usage, ideally to use a computer as heating
replacement.

------
DonnyV
Thinks using a web server is too much. Then recreates http. ¯\\_(ツ)_/¯

~~~
de_watcher
Reinwheeling is what the modern web is.

------
sqldba
Calling it CGI seems like an awful awful move.

------
mikece
This is fantastic and long overdue.

