Author: John Rah

Debug.WriteLine isn’t working

A great way to debug your code is to write values or notifications out to the debug window. Adding a simple line like so should write the text to your Debug window in Visual studio: Debug.WriteLine("Something really cool just happened") But when you run your code your Debug window stays empty: What’s going on here? Well, there’s an option to send all of the debug output to the immediate window and this is turned on by default. This isn’t what we want, so to change it go to Tools -> Options and select Debugging -> General. In the list...

Read More

Update Live Tiles by using a background task

Background tasks come in handy when you want your app to do something even if it isn’t currently running on your device. Once of the most common things to do is update your live tile. Background tasks run in a separate process from your app and are installed at the same time you app is installed. Because it’s a separate process it needs to be a separate assembly. So the first thing we need to do is add a new project to your current apps solution. Let’s get started: Create the background task project In Solution Explorer, right click...

Read More

Using Custom Fonts in UWP

You can use any True Type Font (.ttf) in your app relatively easily. Here’s how: Copy your ttf font file into the Assets folder Make sure the properties of the font file are: Build Action: Content Copy to Output Directory: Do not copy To use the font in your XAML file reference it like so: <TextBlock Text="My Custom Font" FontFamily="Assets/fontfilename.ttf#FontName"></TextBlock> To use the font in your VB Code set it like so: textBlock.FontFamily = New FontFamily("Assets/fontfilename.ttf#FontName") To get the FontName, right click on the .ttf file and select Properties -> Details. Use the Title as the FontName For example...

Read More

Quick and Easy API Versioning

There’s many different ways to handle API versioning. Some require a bit of set up but add lots of safe guards and help for you as a developer. For me I prefer what I call the set and forget method. The idea is that once you have decided to move on to a new version of your API you want to leave the old one as it is and just work on the new one without affecting any users who are still mapped to the old version. I recommend implementing versioning at the start of your development but it’s...

Read More

Using Attribute Routing for your Controller

When I create a new ASP.NET MVC project one of the first things on my to do list is to implement attribute routing. It’s a much cleaner (and obvious) way to handle your POST and GET functions for your web service. Have a look at the code below: <Route("api/GetDailyStats/{UserID}/"> <HttpGet> Public Function GetDailyStats(ByVal UserID As Long) As List(Of DailyStat) End Function I can see exactly what URI path I need to call for this function, what parameters it is expecting and that this is a HTTP Get function. Setting this up is really easy. Just follow these steps: Using...

Read More