Edi Wang

.NET and Azure Developer

Posts in October 2017

Automatically Set Text Color on Accent Background in UWP

Windows 10 allows users to set accent color for the system, and in UWP apps, we usually honor those settings by using XAML pre-defined resource keys like {ThemeResource SystemControlBackgroundAccentBrush}. But regardless of how the user set default app mode to dark or light, when we apply text on accent colors, it may have some problems. For example, when the App is in light mode, the default …
XAML UWP

Get Client IP Address in ASP.NET Core 2.x

In classic ASP.NET we used to get client IP Address by Request.UserHostAddress. But this does not apply to ASP.NET Core 2.0. We need a different way to retrieve HTTP Request information. 1. Define a variable in your MVC controller private IHttpContextAccessor _accessor; 2.  DI into the controller's constructor public SomeController(IHttpContextAccessor accessor) { _accessor = accessor; …
.NET ASP.NET

Configure VSTS Build for UWP Apps

UWP Apps usually require a lot of time to compile a "release" package for submitting to Windows Store, and if you are working in a team, TFS/VSTS can help your team ensure that each check-in has a success build, and make it easier for deployment and testing. Let's see a basic example of how to setup a CI build for a UWP App on VSTS. Important Pre-condition: Before you do that, please ensure that …
UWP Azure DevOps