Jimmy Engström


Universal apps and NotificationsExtensions - Live Tiles (Part2)

2014-04-14 00:45:00 +0000

Here is how to handle live tiles the easy way in Universal apps.

First add the “NotificationsExtensions.UniversalApps” Nuget package.

See blog post showing how.

Tile templates comparison:

This is how to update your tile with a scheduled update.

//Create wide tile update
ITileWide310x150Text09 tileContent = TileContentFactory.CreateTileWide310x150Text09();
tileContent.TextHeading.Text = "Wide Tile Text";
tileContent.TextBodyWrap.Text = "More text on the tile";

//Always add a 150x150 tile update also  
ITileSquare150x150Text04 squareContent = TileContentFactory.CreateTileSquare150x150Text04();
squareContent.TextBodyWrap.Text = "More text on the tile";
tileContent.Square150x150Content = squareContent;

ScheduledTileNotification futureTile = new ScheduledTileNotification(tileContent.GetXml(), DateTime.Now.AddSeconds(15));


To update your tile right away you can use these lines instead of the last two above:

TileNotification tileNotification=new TileNotification(tileContent.GetXml());



Microsofts code sample:


Nuget version


Universal apps and NotificationsExtensions (Part 1)

2014-04-14 00:31:00 +0000


This is a series of blog posts on how to do notifications in Universal apps.

Managing notifications can be a bit “tricky”, you need to edit xml (or write the xml as a string yourself).
Luckily Microsoft has provided an Universal app project in their sample code that helps with creating notifications, it uses nice interfaces and classes to create the notifications.
I took their help classes from the sample, compiled and uploaded it as a Nuget package to make it simple to do notifications.

Right click on the solution then choose “Manage Nuget packages for solution”

Search for NotificationsExtensions.UniversalApps, press install.


You need to make sure you add the package to both the Windows phone and the Windows Store project (you don’t need to add it to the shared project).

To be able to do notifications you also need to enable Toasts, open edit Package.appxmanifest in the Windows phone and Windows 8 project and set Toast capable to “yes”.


Now you are good to go!

Microsoft has made the tiles and toast templates available on both platforms (Awesome!), they may look a bit different, see links in each blog post:
Live Tiles




Microsofts code sample:


Nuget version


Download all the videos from Build 2014

2014-04-06 04:51:00 +0000

Build 2014 was packed with announcements and fun stuff.
Still have a lot of videos to watch =)

Here is an updated version of my script I previously blogged about here.

cd "d:\build14"

$pattern = "[{0},\:,\']" -f ([Regex]::Escape([String][System.IO.Path]::GetInvalidPathChars()))             
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$a = ([xml](new-object net.webclient).downloadstring("http://s.ch9.ms/Events/Build/2014/RSS/mp4high"))
$a.rss.channel.item | foreach{ 
    $url = New-Object System.Uri($_.enclosure.url)
    $file = [Regex]::Replace($_.Title + " " + $url.Segments[-1] , $pattern, ' ')
    if (!(test-path $file))
            (New-Object System.Net.WebClient).DownloadFile($url, $file)


Just copy the code, paste it into a file called “Build2014.ps1”, create a directory (in my case “d:\Build14”) and change the path in the first line of the script.

Right click on the file and choose run with PowerShell.


In case you get a problem similar like “Build2014.ps1 cannot be loaded because running scripts is disabled on this system.”

Start PowerShell as an administrator and run “set-executionpolicy unrestricted”, this is probably a bad thing to do for security.

Using Visual Studio 2013 as an external editor with Unity 3D

2014-02-03 22:11:00 +0000

Unity is really hot right now.
Out of the box unity comes with MonoDevelop, even though I like MonoDevelop I like CodeRush even more, and I have noticed that MonoDevelop doesn't always do the things that I want.
The solution is of course to use Visual Studio instead.

1. Start unity and choose Edit –> Preferences…
2. Select External tools

In the External Script Editor drop down you may notice that Visual Studio 2013 is not part of the items.
(earlier versions will be available if you have them installed).


3. Choose browse… and browse to “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe”
Now “Microsoft Visual Studio 2013” will appear in the drop down and you are all set, from now on Visual Studio will launch when you edit script files.



Using RC API on Windows 8.1

2014-01-12 23:09:00 +0000

This is a short blog post on how to get RC API working on your Windows 8.1 Device.


Download RCAPI from Nuget




To be able to communicate thru Bluetooth you need to edit Package.appxmanifest

Add the following lines:

    <m2:DeviceCapability Name="bluetooth.rfcomm">
      <m2:Device Id="any">
        <m2:Function Type="name:serialPort" />



Pair with the device

Go into settings (win + c, Settings) , Change PC Settings, PC and Devices, Bluetooth



The Car

Instantiate the car and you are good to go, the car class connects to the correct Bluetooth device automagically.

Ferrari458Italia ferrari = new Ferrari458Italia();

To start sending commands to the car you need to call the ConnectAsync method and call the Start method.

await ferrari.ConnectAsync();


Controlling steering and speed

There are two properties controlling speed and steering.

Steering is –1 to 1 (left to right) and speed –1 to 1 (backward to forward).

In the sample projects I have used the Virtual Joystick project available on Codeplex for speed and steering, there is a modified version in the Windows Store sample project.


Controlling the lights

The lights are exposed through properties, to turn the light on use:

ferrari.HeadLightOn = true;

The lights available on the Ferrari 458 Italia is Headlights,blinkers (left and right) and break.

To get the lights to blink it is possible to supply an array with a light enum so if you want the blinkers to blink left

ferrari.LightSequence = new byte[] { (byte)LightEnum.LeftBlinker, 0 };

To get a more fun blinking sequence you might want to try something like this

ferrari.LightSequence = new byte[] { (byte)LightEnum.Head, (byte)LightEnum.RightBlinker, (byte)LightEnum.Break, (byte)LightEnum.LeftBlinker };



Trimmer property makes it possible to adjust the wheel orientation 0 to 15 and 8 is straight forward.