Building apps? This is the stuff about that
07 Apr 2013

XAML (Windows Store apps) editing in Visual Studio broken with NVIDIA Optimus

I have a fancy laptop that seems to delight in giving me headaches, and the latest is to do with Windows Store app development. The problem is simple, you edit the XAML and nothing happens! You need to trigger a full redraw of the screen to get it to render the changes, the below video may explain it better:

The issue here is that my fancy laptop has two graphics cards, a low powered Intel one (great for battery – average for performance) & a high powered NVIDIA one (bad for battery – great for performance). Add to this, that it uses a new technology from NVIDIA called Optimus which allows individual parts of the screen to be rendered by each card – the best explanation of this can be found on SuperUser.

So what is the solution to this problem? Disable one of the graphics card – yeah, that is the work around at this point. I am doing this by using device manager to disable the NVIDIA one.

image

That fixes the rendering issue and allows Visual Studio to work properly. Not great by any stretch of the imagination.

02 Apr 2013

Haven't I seen these presentations before?

imageIn a few short weeks I will be speaking at TechEd Africa 2013 and if you have come to my talks before (previous TechEd’s, TechDays, Hogshead when I have had one too many) you may see that I am giving similar sounding content – so why should you come to these TechEd talks? What will be new and awesome? I am going to give you an honest review of what you can expect from the three talks below.

Windows Store Apps, Tips & Tricks from the field

This is a brand new talk, filled with awesome new content for people developing apps for Windows 8 today & going forward to the Windows ‘Blue’ world. Some of this is from Windows Store app Development Snack series but not all of it, especially in the architecture & tooling sections of the talk.

Note: This is not an introduction to Windows Store apps talk – I will assume the audience has some of the concepts of apps already. So for example, I will talk about background tasks but not explain what they are or where they used in any depth.

What’s new in .NET 4.5 & VS 2012

Same title as my TechDays talk and really this is the version 2 of that talk. So what can you expect different from TechDays?

  • Part 1 is very similar, in fact you could probably just watch the YouTube video of that part & get 95% of the content. I will have some new tricks, especially since we have two updates to VS available now & I have adjusted the emphasis in some places – but that is the only changes in part 1.
  • Part 2 is very different, both the WCF & LightSwitch sections are gone! LightSwitch was dropped because I have an hour long talk just on that :) WCF was dropped since the demo’s were not great and despite it being an amazing tool, the focus for the talk needs to be what’s new – and the new way for API’s is WebAPI. Do not read that as WCF is dead – hardly, just it doesn’t meet this talks requirements. This means I freed up a lot of time, so I am filling it with A LOT of new ASP.NET content. I will show you tricks & tips in ASP.NET land that will blow your mind away!

What’s new in LightSwitch

This session is vastly different my previous LightSwitch talks – we will start in roughly the same way and look at what it does however rather than 1 hour on that, we do a higher level treatment of that in 20min.  So if you never have seen LightSwitch – I am ensuring you are catered for. That is followed by a quick view of the new stuff and then finally we look to the future and the amazing new items coming down the line.

This talk is aimed at those who have never seen LightSwitch, those who have & those we are using it and want to see where it is headed – so basically everyone :)

25 Feb 2013

Visual Studio 2012 Update Guide

Version: 2 – March 4 2013

This page is meant to provide a one stop shop for the updates that are available for Visual Studio 2012. Included here will be only updates from Microsoft. Some maybe betas, CTPs etc. If you think I have missed any please contact me!

VS_Purp256_rgb (1)Visual Studio Update 1

VS_Purp256_rgb (1)Visual Studio Update 2 CTP 4(NEW/UPDATED!)

Git-Icon-1788CGit Tooling for Visual Studio

VS_Purp256_rgb (1)Productivity Power Tools 2012

NuGet_project_logo_svgNuGet

web essentialsWeb Essentials 2012

AzureVS2012_LogoASP.NET and Web Tools 2012.2

AzureVS2012_LogoWindows Azure SDK for .NET (VS 2012) 1.8.1 - February 2013

VS_Purp256_rgb (1)Microsoft Office Developer Tools For Visual Studio (NEW/UPDATED!)

WFM-128pxWorkflow Manager Tools for Visual Studio 2012

expressWindows Phone SDK 8.0

sql-option-aSQL Server Data Tools for VS 2012 December Update

odatalogoWCF Data Services 5.0 for OData v3

Want more extensions for Visual Studio? Check out the 31 extensions created by Microsoft for Visual Studio 2012 on the Visual Studio Gallery

Timeline (out of date)

Since I like to visualise these things here is a timeline of the updates:

image

Download timeline in Excel

20 Jan 2013

Dealing with off by x issues when using the TextBox

image

Introduction

One of the toughest problems I faced when I built Notepad Classic was an issue where many functions like Go To & Find were always off a few characters. After a bit of experimenting I noticed a pattern, it was off by the number of characters equal to the line number (0 based).

i.e.: no issues on the first line (line index 0); Off by one on the second line (line index 1); Off by two on the third line (line index 2); Off by three on the forth line etc…

Problem

It turned out that the way the string functions count a line break (i.e. \r\n) as two characters, and rightly so – it is two characters a \r & a \n. However the TextBox functions like Select treat \r\n as a single character because that is what is displayed visually – a line break is one character visually. So there is a difference between the two scenarios and thus the “off by one x line count” error I found.

Solution

The solution I used is to compensate for it by working out the number of lines to the point (i.e. count all the line breaks before the point) and adjusting the results (adding +1 for each \r\n) as needed.

Sample application to show this problem and the solution can be found at: https://bitbucket.org/rmaclean/off-by-one-x-sample-code

13 Dec 2012

NDepend + Windows Store apps = WINNING

I <3 NDepend, it is an amazingly powerful tool that is brutally honest & unforgiving, and the rewards it brings are massive. Building Windows Store apps without it has always worried me – how do I know if this is going right? Thankfully yesterday the NDepend team released 4.1 which includes support for Windows Store apps, which includes the ability to analyse the .winmd files too!

This not only means I have personal benefits, but it is a sign of something too. NDepend really is cutting edge, and so the sign that they professional tools are arriving for Windows Store apps really shows commitment from the community to the platform! This means it will get easier and better to develop Windows Store apps in the future!

You can download a trial of NDepend at http://www.ndepend.com/NDependDownload.aspx

30 Nov 2012

Presenting on Windows 8 - Pro tip

image

This tip is aimed at presenting, but is just as useful to those who want to focus in Windows 8 without distractions!

Windows 8 is a great operating system to use, especially the background tasks system that ensures other applications are not destroying your CPU & memory. However, there is a downside to background tasks!

Previously, if I wanted to ensure no annoying Skype popups (during my talks for example) I just shutdown Skype and no popups could occur, but in Windows 8, since the application isn’t running, how do we stop the popups?

It is a simple solution, bring up the settings charm (see image on left) and in the bottom right hand corner is an option called Notifications. If you tap that, you will get options to block notifications for 1, 3 or 8 hours.

I am tending towards 3 hours for my 1 hour talks to allow for setup, clean-up etc.

image

Once you have disabled it, the icon will change to show you it is disabled! If you want them back, for example when you are finished, then you can tap the icon again to enable them!

image

What is great is that live tiles & the background tasks still occur, just no popups anymore.

29 Nov 2012

Windows Store app Development Snack: File Type Association Icons

For more posts in this series, see the series index.

image

One of the declarations you can have with a Windows Store app is the file type association, which lets file types become associated with your application. This means you can customise the icon for the file type & if the user double clicks an associated file, it will launch the application.

One of the properties of declaration is the logo property which is the icon to use for the file type. Logo is optional and if you do not specify it, or you specify it incorrectly, it uses the applications small icon (i.e. the 30x30) one – which doesn’t look great.

image

The solution to this is to correctly specify the logo, but that isn’t as straight forward as it seems. Firstly you don’t just have a single image you need FOUR icons with different resolutions

  • 16x16
  • 32x32
  • 48x48
  • 256x256

Next you need to name them correctly, the format is <name>.targetsize-<resolution>.<extension>, so for example if we wanted to use MyLogo.png as the file name we would have:

  • MyLogo.targetsize-16.png
  • MyLogo.targetsize-32.png
  • MyLogo.targetsize-48.png
  • MyLogo.targetsize-256.png

Lastly is putting in the correct logo name in the manifest, since you have four icons what do you use? You use the name + extension components. Using the example about we would have MyLogo.png as the name & Windows 8 is smart enough to figure out the resolution, insert the target bit and get the right image for the right resolution!

28 Nov 2012

Windows Store app Development Snack: Background Colour

For more posts in this series, see the series index.

When you are configuring the appxmanifest for your Windows Store app, one of the options is the background colour for the tile – YOU SHOULD ALWAYS SET THIS!

image

It is used for two things, firstly if your image is transparent this is the colour that will show through for example for Notepad Classic that is what I do – the actual image is just plain white & transparent.

image

The second one, which is not always the most obvious is when a small icon is needed, for example you do a pinch gesture on the start screen (semantic zoom is the technical term for it), the background colour is what is used as a border around the image. Below you can see a screen shot from my machine, and note two of them have this ugly black border – that is because they do not have a matching background colour set!

image

It is not always possible, especially for games with rich tile icons (note Angry Birds in the screen shot below) but I would suggest trying to find a similar colour anyway for example the top two below have a similar colour & Jetpack Joyride (the last one) chose white (which is at least better than ugly grey).

image

Another location for the small icon is the search charm

image

Pages