Pages

Wednesday 1 August 2012

Windows 8 and HTML Part 2: 3rd Party Frameworks

In this installment, I take a VERY quick look at how you can leverage 3rd party JavaScript frameworks like jQuery in your Windows 8 Metro-style applications.



The biggest change when working with 3rd party frameworks (3PFs) is that you must copy the script files for the framework to the project.  This is for two reasons.  First, your app has to run when it is not connected to the internet, so you need those files local.  Second, external content, even if it is available, runs in a different security context than local code.  That difference in security context can cause problems with some 3PFs.  If you are working with the project we started in Part 1, you can just add the 3PFs to the js folder, or anywhere else, for that matter.  In my case, I added jQuery and jsRender script files to my project’s js folder (see pic at right).

Read full article here

Windows 8 and HTML–Part 1: Simple Example

This is the beginning of a multi-part series that will explore building a Metro-style HTML/JavaScript app on Windows 8.  I’ll try and keep the videos short, usually around five minutes, though some may go up to around ten.  I will also have a blog post that accompanies each video that will essentially cover the same concepts.  The videos may show some extra tips or tricks, but the basics will be covered here.  Make sure you go to http://aka.ms/30Days to get all the info and resources you need to start building your Windows 8 apps.  Register now and follow my series to hit the ground running on getting your application done and into the Windows Store.

Read full article here

Showing the AppBar for HTML Metro Applications in Design Mode using Expression Blend for Visual Studio 2012

Showing the AppBar for HTML Metro Applications in Design Mode using Expression Blend for Visual Studio 2012Showing the AppBar in XAML Metro Applications requires no special tips or tricks, just place the code on your page and open it in Blend and you will see the AppBar:
 
HTML Metro Application on the other hand doesn’t have this luxury, instead you have to enabled it. Open Visual studio 2012 and create a new JavaScript Metro Application and replace everything inside default.html

Notice the div that specifies the AppBar. Go ahead and right click on default.html and open it in Blend. Once launched, you won’t see your AppBar in the design view. You have to manually navigate to your AppBar from the Live DOM then right-click and say “Activate AppBar”

Read full article here

How to send an email in Windows 8 C#/XAML metro app

Windows 8 Metro app: How to send an email

In a Windows Phone 7 app, sending an email requires an instance of EmailComposeTask. EmailComposeTask is really easy to use and self-explanatory:

In Windows 8 Metro app, there’s no EmailComposeTask. Instead, you create a “mailto” –uri and launch it:
But when compared to an EmailComposeTask, this only fills the “To” –part, but what about the “Subject” and “Body”? Well, the mailto-syntax allows you to define these as query parameters. For example, here’s an example of defining the “subject”, “body” and “to” –fields from code. The uri is automatically escaped by the platform:

var mailto = new Uri("mailto:?to=recipient@example.com&subject=The subject of an email&body=Hello from a Windows 8 Metro app.");
await Windows.System.Launcher.LaunchUriAsync(mailto);


Read full article here

A Quick Note On Pub-Sub / Event Aggregators In WinJS/WinRT

By now you know that I’m a fan of pub-sub / event aggregators, whether it’s .NET / Winforms or Backbone or whatever. For the last 3 weeks working on this WinJS / WinRT app with the Microsoft P&P group, I’ve had this thought that I want to do the same thing in WinJS / WinRT apps. Only I couldn’t figure out how. @Bennage and I had several discussions on this and decided to look in to it later. Well today was “later” apparently, and thanks to the Chris Tavares I found these wonderful little nuggets of awesome:

WinJS.Application.queueEvent – queue an event to be sent
WinJS.Application.addEventListener – handle an event that was sent

Read full article here
Web Informer Button