WinRT
Posts regarding Windows Runtime (WinRT)
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)
...
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...
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: ...
Here’s a simple tutorial about using Expression Blend for HTML5 and some little Javascript to create a simple transition effect. Fire up Expression Blend 5 and by double clicking the elements on Assets library add a button and a div, let’s rename it by double clicking them in LiveDOM pane. Here’s live DOM contents and it’s HTML counterpart (I’ve manually added button Go! content) ...
I can hardly imagine any serious web development without JQuery so I did a quick test to check if it can be used inside a WinJS project and answer is: yes! even if not in its total completeness. You can’t use any CDN to get JQuery library, it must be included in your project (quite obvious since application must load even without any network connection) so I’ve grabbed latest version and added it to my WinJS project I then later created a very naïve HTML page: <!DOCTYPE html><html><head> ...
In WinRT any method that takes more than 50 ms is exposed as an asyncronous operation and thanks to C# await keyword (or Javascript’s Promises) what could be a programmer’s headache becomes a straightforward task, but what if you have your own asyncronous code? Let’s say you have a basic downloader class that simulates downloading a string from the internet, in practice something like: public class MyDownloader{ public event EventHandler Completed; public string Result { get; set;...