Posts

gRPC server in a WorkerService

A few days ago, I was working on a client-server application where I was going to use Sockets to establish communication. But then I had the idea that I could use gRPC, which would expand the range of possible clients. Plus, it would serve as a learning experience for me to use gRPC. The first surprise was that Visual Studio only offers a gRPC template that requires an ASP.Net server. So, I decided to do some research since my application would use a WorkerService that would likely run as a Docker image. After doing a little research, I decided to start testing, and this is the result. Server The first step is to generate a WorkerService application in Visual Studio. Then, the following Nuget packages in their most updated version should be added: <PackageReference include="Grpc" version="2.46.6"> <PackageReference include="Google.Protobuf" version="3.22.1"> <PackageReference Include="Grpc.Tools" Version="2.53.0...

Using platform-specific page background

Image
In the previous post I showed you how to use the Mica background for the Windows head application. Unfortunately Mica backdrop cannot be used with the other platforms. In this one I want to show you how to use different backgrounds depending on the different targets. Add a new class to the App project and named it PageExtensions.cs internal static class PageExtensions {     public static void SetPageBackground(this Page page)     {         Brush brush; #if WINDOWS && !HAS_UNO         brush = new SolidColorBrush(Microsoft.UI.Colors.Transparent); #elif __ANDROID__         var stops = new GradientStopCollection();         stops.Add(new GradientStop() { Color = ColorHelper.FromArgb(0xff, 0x3d, 0x3d, 0x8d), Offset = 0 }); ...

Using Mica backdrop with UNO Platform applications

Image
Recently a user asked in uno-platform's discord channel if the WinUIEx package works with Uno Platform. Morten Nielsen , the WinUIEx developer -(AKA   dotMorten )- stated that it can only be used with Windows: "WinUIEx is for use with WinUI/Windows. It’s not a cross platform api in any way.  You can use it in Uno for windows targets only." If you are interested in applying the Mica backdrop to the Windows head of an UNO application, I can show you a tip that worked for me. At the time of writing I was working with Uno Platform 4.7 and WinUIEx 1.8.0. First of all add the WinUIEx package to the Windows project. dotnet add package WinUIEx --version 1.8.0 Important : If you have a background in your xaml covering the backdrop, i.e. a ShellPage with a NavigationView, be sure to set the background Transparent.  If you need a different background color for the other platforms, you can use platform-specific C# code or platform-specific XAML markup . Let me thanks Marten f...