April 2012 Blog Posts

Using C# code inside a Metro HTML application

Let’s say you’re working on a HTML Metro app and you’d like to reuse some C# code instead of rewriting, the good new is that you can, here’s how: Create a blank new WinJS application and add a div inside default.html page: <body> <div id="output"></div> </body> Now add a new C# library to WinJS solution: Change the output type of the library project to WinMD file   let’s add a couple of classes to C# library, we’re going to consume them from our HTML application: public sealed class Person { public Person(string name) ...

posted @ Friday, April 27, 2012 9:07 AM | Feedback (0)

Test Azure configuration change using local development environment

Azure applications, may have a set of parameters associated, this allows you to change your app configuration without having to redeploy the entire package (a long operation in any case). You can control how an application reacts to a parameter modification by subscribing RoleEnvironment.Changing event, if you want to restart the whole role when a parameter change you can simply set Cancel=true inside Changing event: RoleEnvironment.Changing += (s, e) => { ...

posted @ Friday, April 20, 2012 3:28 PM | Feedback (1)

Copying and moving styles using Expression Blend for HTML

Here’s a couple of Blend tricks I’d like to share: Let’s say you have this HTML fragment: <body> <H1>Content goes here</H1> </body> by looking at Blend’s css properties pane you can see that, it has some css rules automatically applied: you can copy the applied rule and paste it into another stylesheet by right clicking the highlighted row into selecting copy:   Now go to the Styles pane and click the “+” button shown in the picture below to add a new stylesheet: then right click new file and select paste from context menu to paste the selector. If you already have...

posted @ Monday, April 16, 2012 7:57 AM | Feedback (0)

Fragment loading and Navigation in HTML5 Metro applications

Navigation is one of the core concepts of any Metro application, in this post I’ll show how can you implement it in a HTML based Metro application. The easiest way is to use the same common approach used by millions of HTML pages: using an hyperlink. Assuming you are in default.html page and wish to navigate to page2.html all you need to do is add something like: ...

posted @ Tuesday, April 10, 2012 11:38 PM | Feedback (0)