Dynamic Menu in MAUI

Context The requirement here is to be able to add dynamic menu items to a MAUI app. The use case chosen here is of selection of a font from a list of fonts installed on the machine. The list of fonts is shows under a menu item in the menu bar. More on menu bar from the Microsoft documentation Approach Step 1: Mark up The component to be used here is the MenuBarItem. This component support binding context of the content page. As part of the page markup, a menu item is added to the page and the “Choose Language” menu item is left blank, so that the menu items can be added after fetching it. ...

September 26, 2022 · 2 min · 402 words · Me

Cloud Resume Challenge - Azure Serverless

I recently came across the site https://cloudresumechallenge.dev/ and decided to give it a try using Azure services. To start simple I decided to ignore the DB, CDN part etc and just have the the UI and the middler layer of the app. Below is the high level architecture. The front end of the app will be hosted a static web site in Azure Blob storage. Backend will be an Azure function that will feed the resume data to the frontend over HTTP, the azure function will be a HTTP triggered function. Currently the resume data in JSON format hardcoded in the Azure Function code. As an upgrade to the app, the JSON data can be moved to a CosmosDB instance and put an Azure CDN in front of the UI to deliver content fast to users. ...

June 28, 2021 · 4 min · 848 words · Me

Implementing Custom Feature flags - Your own logic to shutoff a feature - Azure App Configuration

This is a continuation from the previous article on feature flags implemented using Azure App configuration service to maintain the flags. Just to reiterate, feature management can be implemented using config files but this article is trying to implement feature flags connecting to Azure App configuration service. Introduction The previous article described about implementing a boolean feature flag to turn on/off a feature. In this article I am trying to implement a custom feature flag. Microsoft provides few predefined custom feature flags or feature filters (as they are called) Targeting, TimeWindow, and Percentage (more about it here), which covers most usecases, however, there might be situations where you find the predefined ones falling short. In this article I am building a filter ground up with a made up custom logic. ...

June 22, 2021 · 4 min · 666 words · Me

Radio Player using Blazor 5

I have been reading the Blazor 5 documentation and decided to create a simple project to give its features a try. As always, there were a ton of ideas in my mind but while scanning through dev.to i came across a post by Aleks Popovic, where he made a Radio player using react, so i decided to create one using Blazor 5. I used the same service as Aleks to get the radio stations, called the Radio-Browser. ...

May 11, 2021 · 3 min · 582 words · Me

Infrastructure as C#

Introduction After attempting the .Net tutorial on deploying a simple WebAPI based microservice to Azure Kubernetes Service (AKS), wanted a better way to represent my infrastructure than the YAML.xml file. This was partly because of me being novice in YAML format and partly to have a way to abstract the infrastructure in order to make it repeatable and it should be not just confined to AKS. The first solution to this problem was to use a framework like Terraform to define my infrastructure as code. But this will lead me learn new language and language constructs like loops, conditions etc. The search was over pretty soon after I found a framework called Pulumi, that lets me write my infrastructure in many of the populate programming language including C#. So i decided to convert the .Net tutorial YAML into a pulumi project and see how well it runs. ...

July 26, 2020 · 3 min · 557 words · Me

Steps for Deploying a Blazor as Static Site with Docker and Nginx

Step 1 Publish the Blazor WebAssembly project Publish the project from Visual Studio,this ensures that the projects is linked which removes all the unwanted dependencies from the output, reducing the size of the assemblies created. Step 2 Create a dockerfile The docker file is very straightforward, pull the nginx image and copy the published Blazor WebAssembly file from the WWWRoot folder to the html folder in nginx ...

June 11, 2020 · 1 min · 150 words · Me

Hosting Blazor WebAssembly on ASP.Net Core WebAPI

Background My WebAssembly project has now been configured to be a PWA (refer the previous article in series). It time to introduce hosting. Since the WebAssembly project handles the client side, I want it to be unchanged but be hosted it in a project that can be used as backend for the UI, hence chose WebAPI. The Changes Create a new solution and add the already created Blazor WebAssembly project Add a new ASPNet core web project and choose WebAPI template and call it the .Server project Add reference of the WebAssembly Project to the .Server project. Install package Microsoft.AspNetCore.Components.WebAssembly.Server to the .Server project. This package contains the runtime server for Blazor application. In the startup class add configuration to the request pipeline to handle Blazor and its routing. // This methods serves the WebAssembly framework files when a request is made to root path. //This method also take path parameter that can be used if the WebAssembly project is only served //from part of the project, giving options to combine web assembly project with a web application app.UseBlazorFrameworkFiles(); //This configuration helps in serving the static files like //Javascript and CSS that is part of the Blazor WebAssembly app.UseStaticFiles(); //Add the below configuration to the end of the UseEndpoint configuration, //this will serve the index.html file from the WebAssembly when the WebAPI route //does not find a match in the routing table endpoints.MapFallbackToFile("index.html"); Your ASPNet Core hosted WebAssembly project is ready to be published and deployed. Pretty easy! ...

June 9, 2020 · 2 min · 278 words · Me