Generate multiple PNG images with Inkscape SVG for Windows 10 Universal UWP apps with Powershell

I’ve been using Inkscape for many of my projects, it’s a great open source SVG vector editor. Windows Universal apps support scaling to pixel density for multiple resolutions. I made this Powershell script to generate PNGs scaled to multiple resolutions from your vector SVG files, so your app can look pretty at all resolutions. Using it is very easy:

  1. Make sure Inkscape is in the PATH
  2. In Inkscape create separate SquareLogo.svg and WideLogo.svg files, and size each document to fit the logo.
  3. Run the script, and it’ll produce about 30+ rescaled images that you can use in Visual Studio manifest editor.
# create a set of tiles for Universal Windows apps
# with Inkscape
# 1. Add Inkscape folder to PATH
# 2. place SquareLogo.svg, WideLogo.svg, Splash.svg into $dir
# images will appear in $outDir
$dir = "C:\svg"
$outDir = "C:\svg\images"

$squareSizes = @(71,89,150,107,142,284,600,300,150,225,188,1240,620,310,465,388,176,88,44,66,55,256,48,24,16,200,100,75,63,50)
$wideSizes = @(1240,620,310,465,388)
$splashSizes = @(2480,1240,930,775,620)

# square images
foreach($size in $squareSizes){
    $res = $outDir+"\"+"SquareLogo-"+$size+".png"
    inkscape --export-png $res -w $size $dir"\SquareLogo.svg"

# wide images
foreach($size in $wideSizes){
    $res = $outDir+"\"+"WideLogo-"+$size+".png"
    inkscape --export-png $res -w $size $dir"\WideLogo.svg"

# splash
foreach($size in $splashSizes){
    $res = $outDir+"\"+"Splash-"+$size+".png"
    inkscape --export-png $res -w $size $dir"\Splash.svg"

Wearables: building cross-platform wearable apps with Visual Studio and C# (Part 2)

Please see: Creating beautiful cross-platform apps for iOS, Android and Windows with Visual Studio. Part I. User Interface

(this is a multi-part series on mobile cross-platform technologies available with Visual Studio)

Microsoft Bing predicts wearables to be the hottest trend in 2015. You can check Bing Predictions technology trends right here: According to these predictions, wearables in 2015 are even more important than personal digital assistants, home automation, 3D printing and virtual reality gaming.  This post continues the series on wonders you can do with cross-platform C# and Visual Studio tools on all kinds of devices: Android, iOS, Windows and now getting to even smaller form factors.


So what are the wearables today: at least devices that are available to developers with existing or upcoming SDKs and APIs? Wearables are definitely in the IoT category: smartwatches, bands, things that we wear on our body to take body-specific measurements. The evolution of watches started a very long time ago, literally centuries ago, with the watch becoming more of a fashion item. Later, fitness bands created a new category of smart wearable devices.


Let’s compare some wearable devices available today. If we attempt to classify them, they differ in sensors, functionality, price and purpose. In 2015 we will get an idea of market share each of them have, but the most interesting point: devices you see below can be accessed or programmed with C# and Visual Studio!


Wearables APIs: What’s in common

From the app prospective, since wearables are so lightweight as a platform, they commonly make use of several API tiers that are more specific to small devices:

  • Actionable Notifications: wearables make an extensive use of notifications, including actionable notifications, i.e. those that call back into the host device app, like a phone. You can think of a actionable notification as a message with multiple attached actions-buttons. Android Wear SDK gives a good example of these.
  • Glance, Watchface, Tiles etc – ways to present readable information on the screen. Android SDK has CanvasWatchFaceService for example, which allows developers drawing the face. Microsoft’s concept of tiles is perfect for wearables developers.
  • Apps (optional) – some wearables may or may not have deployable apps (depending on the device and platform) . With apps come specialized controls that can present information on the small screens.
  • History (cloud APIs) – typically wearables synchronize with the phone device and that device in tern synchronizes with the cloud
  • Form factors: Microsoft Band is of band shape, with natural sequence of tiles. Android wear is round and square. Apple watch has a rectangular shape.

    Visual Studio and C# story with Wearables

    With Visual Studio and C# you can develop cross platform wearable apps that run on Android Wear, Apple WatchKit, and we hope to see Band SDK coming out soon. This makes Visual Studio a unique Wearable development platform for all devices. C# is a fantastic language, perfectly suitable for mobile and wearable development. In many ways it is easier to make apps with C# than with the native languages in each platform.

    You can start with these guides:

    Android Wear Developer Preview Now Available

    Introducing the Xamarin WatchKit Preview

    Practical examples of cross-platform apps built with C#

    Here’s a few apps I built with Visual Studio that run on wearables or are capable of interacting with wearable devices.

    Active Fitness

    Active Fitness is a cross-platform (Windows, Android, iOS) fitness, health and sport GPS tracking app and social network of more than a million users. Great for running, walking, cycling, hiking, mountain biking, skiing, snowboarding, urban sports, such as skateboarding, scooter and hundreds of other activities. Active Fitness motivates you by providing ways for sharing your activities with your buddies and friends. Active Fitness has leaderboards for any sports and activities and includes professionally designed training plans. Enjoy and stay fit!



    Winter Sports

    Winter Sports is a cross-platform (Windows, Android, iOS) app, the official app of Professional Ski Instructors of America and American Association of Snowboard Instructors (PSIA-AASI). Beautiful GPS tracking, ski run analytics, snow reports for thousands of resorts, zoomable resort maps, activity tracking, customizable goals, a social network, leaderboards and ski lessons by snow pros. The app includes many innovations, including voice guidance.



  • Winter Sports a showcase cross-platform .NET app available for iPhone users

    Winter Sports, a comprehensive app for skiers and snowboarders is released for iPhone, powered by Microsoft cloud.

    Winter Sports is an official app of more than 32,000 Professional Ski Instructors of America and American Association of Snowboard Instructors (PSIA-AASI), an educational organization teaching seven million ski days per season in the US alone. This cross-platform sophisticated app includes ski and snowboard-specific GPS tracker, snow reports and resorts maps from 2000+ ski resorts worldwide, as well as training, workouts and content for skiers, snowboarders, mountaineering enthusiasts and snow junkies.


    GPS Tracker
    Snow Reports and Resort Maps
    Step Counter
    Friends and Social
    Training and Workouts
    Action Photos
    Ski and Snowboard Analytics
    Worldwide leaderboards
    Powered by Professional Ski and Snowboard Instructors of America

    More about the app…

    Cross-platform apps are becoming very popular with the users, who want to keep their data in sync on iPhone, Android and Windows. Also in line with Microsoft open source . NET Winter Sports became very popular on Windows Phone, grew to millions of users, and now reaches iPhone and Android markets. This app can easily be a showcase of Microsoft’s recent announcement for open-source .NET: a sophisticated native app entirely built with .NET and Xamarin.

    Ultimately, with cross-platform apps, such as Winter Sports, Microsoft wins because the app is using Microsoft’s massive cloud technology called Azure, users win because they can use their favorite mobile device with the app, and developers win because the app works on all major markets: iPhone, Android and Windows. Developers also win, because they only develop one source code, with close to 95% code reuse for Windows, iOS and Android, according to Winter Sports developers.

    Web Site:

    Azure Mobile Services and DateTimeOffset

    Important update: Please, see a comprehensive post by Carlos Figueira that recommends two additional workarounds for this issue.

    I ended up implementing a combination of my approach below and Carlos’ custom JsonConverter.

    I use DateTimeOffset very extensively, my corresponding SQL Azure table in mobile services uses datetimeoffset(3) column. The issue that I had was somewhere during JSON.NET serialization, the DateTimeOffset lost the offset and got converted to UTC. I couldn’t find any solution, until I experimentally started playing with the Mobile Services Client SerializationSettings, exposed in the latest SDK. Changing DateTimeZoneHandling  didn’t seem to help much until I discovered this post by Carlos. I changed it a little bit, keeping the idea, and voila: my DateTimeOffset now saves in Azure Mobile Services, no problem. If you know a better way, please let me know:


                    MobileService.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.RoundtripKind;
                    // remove date time converter
                    var conv = MobileService.SerializerSettings.Converters.Where(c => c is MobileServiceIsoDateTimeConverter).FirstOrDefault();
                    if (conv != null)

    Ready to make some money, Windows 8 is coming!

    This weekend I invite you to my session at Silicon Valley Code Camp 2012:

    We’ll discuss Windows 8 Store, monetization and… a bit of a surprise: for the first time I’ll be announcing my book Professional Windows 8 Programming: Application Development with C# and XAML
    , written with a great team of authors: Nick Lecrenski, Doug Holland, Allen Sanders, Kevin Ashley. At this session we’ll focus on practical aspects of monetizing Windows 8 apps. I’ll share some code examples, including: in-app purchase, trial unlocking, placing ads in the apps and using trial model to support monetization. We’ll also touch on more advanced topics, and as an author of several apps in Windows Store, I’ll be happy to answer your questions.

    Windows 7 sold over 500 million copies in just three years, if Windows 8 does that well this is going to be one of the biggest opportunities our industry has ever seen. Come learn how to get your app into the Windows Store and how to make money. After all, you want to be the first app in the marketplace and have the early mover advantage, don’t you?

    SESSION CODE EXAMPLES INCLUDE: Trial, in-app purchases, store simulation.

    1:45 on Saturday

    Foothill College
    12345 El Monte Road
    Los Altos Hills, CA 94022

    Async CTP – Task based asynchronous programming for Windows Phone

    6 code samples for this post

    [my apps for Windows Phone that use Async CTP Smile]


    Asynchronous programming is super-interesting especially today, with responsiveness required by all modern devices. In the context of Windows Phone 7, Async CTP Version 3 was released last year, and it’s compatible with SDK 7.1, Silverlight 5 and Roslyn CTP. Our takeaways today is using async in the context of Windows Phone 7, understanding TAP (task based asynchronous programming). I’ll show you how deep the rabbit hole goes: we’ll go beyond basics to exceptions, cancellations, progress, switching threads, combinators and even re-entrancy.

    Historical Background

    And let me just say: it’s worth learning NOW, because this model is quickly becoming mainstream, especially with Windows 8 not that far on the horizon. In terms of the where we are with Async CTP Version 3: you don’t need to wait for C# 5.0 to start using it. It has been a long time since 1960s when Steve Russel was one of the first to add continuations to LISP on IBM 704. I like this definition of continuations:

    Say you’re in the kitchen in front of the refrigerator, thinking about a sandwich. You take a continuation right there and stick it in your pocket. Then you get some turkey and bread out of the refrigerator and make yourself a sandwich, which is now sitting on the counter. You invoke the continuation in your pocket, and you find yourself standing in front of the refrigerator again, thinking about a sandwich. But fortunately, there’s a sandwich on the counter, and all the materials used to make it are gone. So you eat it. :-)

    Scheme formally introduced call/cc operations.

    Continue reading “Async CTP – Task based asynchronous programming for Windows Phone”

    5 Windows Phone games great for holiday travel

    In my previous post we discussed using Expression Blend to create a flipping card animation. Since the Holiday season just started, I’d like to share these games I built, that use this technique. Happy Holidays, have a great holiday season, and for those skiers: Let It Snow!

    Continue reading “5 Windows Phone games great for holiday travel”

    Flipping Card animation for Windows Phone 7 using Expression Blend

    Download Source

    In this post I’ll show you how to create a card flipping animation for Windows Phone 7, using Expression Blend. The source code is available for download in the attachment. First, I create a Windows Phone 7 project from scratch, using Expression Blend, you can also create a project in Visual Studio, right click on any page and select “Open with Expression Blend…” context menu option. I actually used this technique in real Windows Phone games I built:

    101 Card

    Continue reading “Flipping Card animation for Windows Phone 7 using Expression Blend”