Blazor support for Mercury (VB)

Now that Blazor is officially released what are the general plans for support and specifically are there plans for support for Mercury (VB)?
Since Microsoft is not supporting Blazor development in VB and does not plan on adding it in the future this would be a MAJOR plus for Mercury.

Blazor support is something we’re looking at (if/when we add it, then for all Elements languages), but right ow our main focus for WebAssembly is on our own native WebAssembly target — which is of corse fully supported by Mercury. See WebAssembly for more details on that.

I have the same problem, because I’m working with Oxygene. What I’m doing is making the less possible code in the main project of the solution (in MS C#) and put all the rest in an Oxygene assembly. So the C# code is really minimal.

1 Like

I’d LOVE to see Mercury support for Blazor. For me, the reason I would prefer that over your native WebAssembly target is that I would (I assume) then have access to the many new Blazor 3rd party controls that are available.

BUT…I understand you can’t do everything!

–Avonelle

2 Likes

Yes, I agree. For my current Blazor project I am using C# and the Telerik Blazor controls.
I would hate to not be able to use the Telerik controls.
I have not looked in to RemObjects’s WebAssembly. I will now.
Is it possible to use 3rd party controls like Telerk’s?

Not .NET based ones, no, but of course try parties could create components and libraries for Elements/Wasm, if they wanted to.

The Blazor Third-Party controls are essential (we will use DevExpress).
We compared Angular and Blazor and found out that it is MUCH less effort to use Blazor (today with C#) instead of Angular with TypeScript.
We will go in that direction with VisualStudio and VB.net.
It would be nice if we can use VB.net instead of C# in the @code part of the *.razor files.

We’re investigating, but right now we have nothing to announce yet for Blazor WebAssembly support, at this stage.

I believe MIcrosoft’s Razor parser supports C# and VB, so that should work (you can test, for regular Razor), but we have not done any testing on that front yet.

I post the same answer here, as I did on Blazor and code-behind files in Oxygene - #16 by Theo69

Blazor is still a Microsoft C# only technology, as the support for it is not in the language but in the compiler. And the only compiler that has the support at this moment is the Microsoft Roslyn C# compiler. So Blazor won’t be supported any time soon as this means that Remobject has to build all Xamarin support first, and that is an awful lot of work.

But Blazor is not the “Next big thing” - that’s only Microsoft marketing.
Web-Assmbly IS the next big thing, and Blazor is just one of the possibilities to create Web-Assemblies.

So, Blazor is just Microsoft’s way to do Web-Assembly.
And if you insist doing Web-Assembly the Microsoft way, the only choice you have is using Microsoft C#. No vendor, platform or language will support it.

But if you want to use Elements (any language), you can use the RemObjects implementation of Web-Assembly. Just select the template Web-Assembly (code behind) and you can build the Web-Assembly code in Mercury or any other language.

With this template you can use the standard VB Handles clause to handle Html events (for other elements languages: just the normal event handler wiring, for Mercury AddHandler and RemoveHandler can also be used).
The code needed to access to the elements in the Html is generated on compile, so you can use the Id name of the Html elements as variable names in the code.
All access to DOM objects is strict and has CC is available for them to enable you to program fast; it’s just like you are programming WinForms.

When you need server access from the WebAssembly, use the Browser.newXmlHttpRequest object, which gives you asynchronous access to any http(s) server resource you might need.

1 Like

OK, I agree, the real “revolution” is WebAssemly.

But let’s take my Company for example: we are working for 15 years now with .NET Framework (4.7.1) and are using WinForms (yes, they still exist).
It’s not end of live but we feel to go in a new direction (not only “feel” e.g. customers are complaining about performance etc.).

First Choice was Angular, but soon we go to Blazor. We currently don’t have RemObjects (and nobody except Me knows about it), so only solution was Microsoft Blazor (and I think that is the way it works in most companys).

In the past MS had done it the way *they" wanted to do, but I feel it’s getting better now.

Me too :smiley:

But when you are using VB .Net and want to do Web-Assembly, you have only 2 choices.
Choice 1: Go to C#, use Blazor and leave VB .Net (as Microsoft wants you to do)
Choice 2: Go to Mercury, and use the Web-Assembly template, so you can keep using VB .Net syntax.

The choice is up to you - you might want to make sure that you are not the only one that knows about RemObjects Mercury anymore by talking about it in your company :wink:.

There are many videos about Blazor (e.g. Carl Franklins Blazor train) which describes the framework very well, can be called as “community”. If you watch those videos you feel “familar” with Blazor even if you didn’t write a single line of code.

If I go to Mercury I have no idea if I can use these videos (most of them) or if I have to start again with a completely(?) new framework.

WebAssembly for Mercury is the good old framework that almost everybody knows: The browser DOM.
See: Introduction to the DOM - Web APIs | MDN

You can use everything that is here, as you could do with uncompiled Javascript (Webassembly = compiled javascript)

Further, everything described here can be used: https://docs.elementscompiler.com/Platforms/WebAssembly

And about those Blazor video’s: no you can not use them as they show Microsoft’s propriety implementation of Web-Assembly, that differs from any other Web-Assembly that is available at any other vendor.

But you CAN use any JavaScript video, as they map 1 on 1 to Elements WebAssembly.

Does that mean I have to write JavaScript Code? I didn’t write a single JavaScript codeline in my life and I do not plan so (JavaScript has the same syntax as C#). That is the Blazor promise, NO JavaScript (of course you can use it if you wish).

No, you just write VB code.

An example on my Twitter: https://twitter.com/Mercury_VB/status/1392564148437929984

Download of that project, so you can see the code: https://builditsolutions.net/downloads/tic-tac-toe.zip

Thanks, I will take a look (at long weekend).

1 Like

No. essentially the JavaScript APIs are available to you from Mercury (just as on .NET the “C#” Apis are available to you.

Yes, and same here, you can do the reverse, talk to your Mercury WebAssmenbly objects from Javascriipt if you need to, too.

1 Like