Posts

Showing posts with the label maui

Add a PWA feature to our Blazor Maui Hybrid application

Image
  I have been working on a series of posts about the Maui Hybrid solution.  I create a desktop and Blazor web assembly web client that uses the same code for the UI and the same code for their backend services. Just for fun or to see if it is even possible, I wanted the ability to deploy the solution as a Progress web app as well.  This gives users an additional way they can get the application and use it.  I have an older post about why you would want to build a PWA. Turn Blazor Web Assembly web client into a PWA The steps are fairly straightforward to archive this: 1. Create a Manifest File:       This is a JSON file that provides information about your application (such as name, author, icon, and description) to the browser. It's typically named manifest.json and placed in the wwwroot directory of your project.  Here's a basic example: {   "short_name": "BlazorPWA",   "name": "Blazor Progressive Web Application",   "icons":...

Maui hybrid Desktop and a Web client share the same database

Image
  In the first couple of posts on Maui Hybrid, Let's Make a Blazor Hybrid app and Blazor Hybrid application, and a Blazor Web application , we covered the basics of creating our Maui hybrid application and a Blazor web assembly application, all using the same UI.  These 2 projects worked nicely together.  It worked nicely. My next step was configuring the Maui hybrid desktop to access the same database as the web client.  Seems easy enough. Turns out it is.  What we need to do is check to see if we are running in a hosted environment, if so, make a call to the server API to get the weather data.  If not, just use the local source. In my demo, I am using the data source from which the Blazor sample app comes, but you could also easily use a database.  Changes to the WeatherForecastService We need to add a flag to the WeatherForecastService to let it know if we are in a hosted mode or not.  To achieve this we add a parameter to the constr...

Let’s Make a Blazor hybrid Application!

Image
    Maui has been out for a while now and I thought I would learn how to create a Blazor hybrid application and see what it is about.   There are blog posts and YouTube videos on how to do this so, see the links below. I am not focusing on the step-by-step but on what I learned by doing this exercise. It will help others.   Prep Work           You will need to make sure you have the Maui project templates installed in Visual Studio.           Go to the VS installer.         a.      Click the modified button.          Make sure under the Desktop and UI Development the .Net Multi-platform App UI development is checked, see image.        If not check it and click modify to install it.     Create the Project 1.      Open Visual Studio and click on “Create new Proj...