codefoster | to inform and to inspire
Jeremy Foster
@codefoster

Update on ReSharper 7 EAP

by Jeremy Foster 28. May 2012 17:48

I opted out of the ReSharper 7 EAP beta for a little while just because it was throwing a lot of exceptions and I had to get some code written, but now I’m back and it appears they’ve made a lot of improvements to it. I am noticing a lot more support in JavaScript code in Windows 8 development, so that’s awesome.

Also, they made it work with VS 2005, 2008, and 2010. Although, if you’re still using VS2005, can I please ask you why? :)

Go here and  download the latest build now and try it out. ReSharper makes you more productive.

 

Tags:

ReSharper | Visual Studio | Windows 8

Long Weekend

by Jeremy Foster 25. May 2012 21:49

It's the long weekend!

Time to breath a sigh of relief and take some time off. If you're a tech head and love your job like me then it might be a bit of a discipline to shut down all the systems, unplug, and relax. But it's worth it.

Surely you've had this experience a hundred times... you are fighting a bug or a seemingly insurmountable technical issue and you feel like you must... just... keep... working. Then you finally give up and step away for some length of time. Upon returning to the issue then, you have it fixed in 10 minutes. That happens to me all the time. So much in fact that I've learned to just walk away and try again later. I think it's a good use of time.

Consider how productive you'll be upon returning from this long weekend then.

I guess if I'm blogging then I'm not unplugged, so here goes. Over and out.

Tags:

Productivity

iPazzPort Giveaway

by Jeremy Foster 25. May 2012 09:43

A what?! It’s an iPazzPort. I ordered one recently and I was sent two. Not a bad deal, but I really only need one, so I decided to give one away to one of my Twitter followers. It’s new in the box. Read on for details. First, what is it...

I have a media center PC. Actually, it’s just a PC that I hooked up to my 37” LCD TV and installed Windows 8 on. I like the start screen tiles on my tablet and my PC, but they’re awesome for a media PC too! I put all of my media related programs on the start screen and now it’s super easy to launch whatever I want.

The device...

Well, I had a little remote control for the PC, but it decided to quit working a few weeks ago, and my wife asked if I could find a good solution. I think I did!

I found and ordered this iPazzPort. On one side it’s a full Windows keyboard including the win key (which is important), arrow keys, and all of the symbols and function keys. Next to the keyboard are buttons to control a gyro mouse, so you can just swing the device around in the air to move your mouse. You can hit a key to switch mouse modes so that you can either hold it the long way or the short way (when you’re using the keyboard). Then if you flip the device over, it has a few basic television remote buttons that you can train with your real TV remote. Finally, there are buttons on the side that act as page up and down which comes in extremely handy for web browsing and such. It has a rechargeable battery, so you just plug it into your computers USB port every few days to charge it up.

The giveaway...

So I sent out a tweet. You can find it here. If you retweet that and follow me on Twitter then you’ll be entered to win. I’ll keep it open until Thursday, May 31. I’ll draw a winner at random on that day and announce them on this blog post and on Twitter by noon Pacific time. If you’re the lucky winner and you live in the United States, I’ll mail you the iPazzPort.

Tags:

Windows 8: Top 10 Reasons Why I Choose HTML5 Over XAML

by Jeremy Foster 23. May 2012 10:26

My colleague and friend Jerry Nixon recently wrote an article on the top 10 reasons why he chooses XAML over HTML5 and it begged me for a reply. Alas, here it is...

Following are the top 10 reasons why I’m in the HTML/CSS/JS space right now.

I should qualify. I completely adore C# and XAML. I geek out on the nuances of the C# language, lambda expressions give me joy, and LINQ is like dreams and starlight. But that’s not where I am right now. I’m moving on but not moving away. I want both bullets in my belt... the sheer power of C# and the wit and fancy of JavaScript.

More qualification. I love JavaScript and at the same time I hate JavaScript. Sometimes it makes me feel like a coding cowboy and other times like I’m in its gallows.

So here we go...

1. Skill Ready

I and about a kazillion other people in the world have gathered a ton of experience on the HCJ stack. Websites became applications as some point, and they became essential in the enterprise. I would guess that the web stack has drastically more developers than any other stack... but that’s a guess.

2. Triptych

HTML, CSS, and JavaScript form what I like to call the happy triptych. Instead of separating code into two roles, HCJ has three. HTML defines the structure, CSS defines the layout and style, and JavaScript defines the logic. This makes things like modifying the layout and style for different view states or devices as simple as swapping out the style sheet.

3. Dynamic

I know that C# has the DLR and I’ve used it in numerous real scenarios, and it’s some awesome functionality added to the language. JavaScript, however, is truly dynamic. If I want to add a property to my app like lastLaunched, I just type app.lastLaunched = “5/1/2012” and voila I have a new property. If I want to add a function called detectLastLaunched, I just type app.detectLastLaunched = function() { ... }. That’s way cool.

4. JSON

JavaScript has JSON. I know that C# can speak JSON too, but not like JavaScript. JavaScript and JSON go together like peas and carrots.

5. Light

JavaScript is light. Super light. The absence of some of C#’s heavy artillery (I’m thinking polymorphism, inheritance, type safety, etc.) leaves it light and agile. The fancier things like inheritance and even asynchronicity are implemented as patterns instead of as language features. This means they’re not baked in so they can be adapted to suit.

I was newing up some sample data in both languages the other day. I had to declare all of my types in C# and then even with object and collection initializers, the code to create the sample data was quite large and repetitive. In JavaScript on the other hand, it’s a matter of declaring a variable and setting it with very terse object initializer syntax... thing of beauty.

Just compare the default Metro style Grid Application in XAML/C# and then in HTML/JS and you’ll see how light JavaScript is.

 

6. Libraries

Again, there are a ton of web stack developers out there and consequently there are a ton of web stack libraries and helpers. Bing something like “javascript face detection” and you’ll find an open source library that’s ready to go. Glance at microjs.com to see what I mean about JavaScript library support.

7. Query Selection

In XAML, it’s easy enough to give a control an ID and then select it in the code. But how do you select all of every third paragraph, the third element in the grid, or something like that. The answer is imperative code. There’s no part of the object model that you can’t access, but with query selectors in CSS and JS, you can use simple strings like “div#myDiv p:nth-child(3n)” to select every third paragraph in the div with the ID of myDiv.

8. CSS

CSS is amazing. With a collection of style rules, I can style, animate, layout, add images, position things, and a ton more. With declarative CSS code I can make the same HTML view look entirely different. Style rules cascade down to the eventual screen element and allow a developer to set a style globally and then override that style locally given the need.

There’s a JS library called LESS that extends CSS’s capabilities and allows me to set style variable and even do variable math. So I can set the base color of my app to red and then create a number of derived colors (darker or lighter for instance). That way, the change of a single color variable will result in a complete change to my app’s color palette.

9. Blend

The nature of HTML/JS apps means that Blend for Visual Studio can dynamically execute the application while you’re designing it. Expression Blend (the XAML designer for classic Windows apps, Silverlight, Windows Phone, etc.) has some robust support for sample data and designer data because it’s not able to drag in the application data at runtime. With Blend, however, when working on a Metro style app using JavaScript, the entire need for sample data goes away. Instead, you look at your real app data... even if you’re pulling it down from the sky (I’m a little tired of the word cloud, so I choose to use the word sky).

10. Name

I live in Seattle. I drink coffee. Fancy coffee. The people that make coffee in this town are insane about their technique, the quality of their bean, and the nanosecond precision of their brew pull. So I’m enjoying JavaScript because it goes so well with the french press of Ecuadorean joe I hold before me.

Sorry, C#. Your name is sharp, but it’s so technical and boring compared to JavaScript.

Nail. Coffin. JavaScript wins hands down! Oh, whatever. It’s all in fun.

Tags: , , , , , ,

C# | CSS | JavaScript | Windows 8 | XAML

Windows 8: Building Up to Blank

by Jeremy Foster 22. May 2012 11:51

When you’re learning a new platform or development stack or seeing something for the first time, it’s an exercise in concept building. If you don’t get the concepts down then you may as well be a monkey walking through steps. And sometimes when you start with a project template, so much has been done for you that grasping concepts involves separating what is fundamental to the technology and what has been done for you by the tooling.

I’m not one to throw the tools and templates out the window. Once you get the concepts down they’re awfully handy. But let’s throw them away temporarily while we learn the concepts and then we’ll run out to the curb before the garbage guy gets here and retrieve them.

I’m going to use Visual Studio 11 (Consumer Preview) and start with a truly blank HTML/JavaScript project and work us up to the blank project - that is - work us up to the project template that you get with VS11, which although it’s called blank is not quite.

Here we go...

Start with the blank template... then kill it...

Open VS11. Create a new Windows Metro Style JavaScript project using the Blank Application template.

Here’s what your Solution Explorer should look like...

image

Notice that you already have a bunch of stuff. So let’s kill it. Delete everything in there except for the images folder (because we’d just have to recreate those anyway). Also, go to the References folder and remove the reference to Microsoft Windows Library for JavaScript SDK.

Your Solution Explorer should now look like this...

image

Ah... clean slate. That’s better. Now it’s time to get started.

Add a default.html file

If you’re going to make an HTML application, you’re going to need an HTML file for sure. So right click on your project and choose Add New Item, then choose a simple, old, plain, no frills, basic, classic HTML file. Actually, it will be HTML5 so I guess that’s not so classic yet. Call it default.html and be done with it.

Type “Hello, World!” inside the body and you should have something like this...

image

At this point, it seems the app would be executable, but if you try you’ll get a message that you’re required to have an application manifest file. That’s one of the few ways in which an HTML/JS app in Metro is different from a website. So we’ll add that now.

Add an application manifest file...

Add a new blank XML file to your project. Call it package.appxmanifest.

There are a few things required in this file. Let’s enumerate.

Below the XML declaration add the Package element...

<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
</Package>

Then inside the Package element add...

<Identity
    Name="dfc9ddf8-dde8-4460-8967-1dbb70b653fa"
    Version="1.0.0.0"
    Publisher="CN=Jeremy" />

The Name value is a unique identifier for your application. You should be safe using the GUID from my example above since I don’t have any plans of publishing this application to the store :) Obviously you can put your name in there as the publisher.

Then add this after the Identity element...

<Properties>
    <DisplayName>Application1</DisplayName>
    <Description>Application1</Description>
    <PublisherDisplayName>Jeremy</PublisherDisplayName>
    <Logo>images\storelogo.png</Logo>
</Properties>
<Prerequisites>
    <OSMinVersion>6.2</OSMinVersion>
    <OSMaxVersionTested>6.2</OSMaxVersionTested>
</Prerequisites>
<Resources>
    <Resource Language="x-generate" />
</Resources>

You can imagine what each of these elements does, so I won’t bore you with the details.

The next section is more interesting. Add this...

<Applications>
    <Application Id="App" StartPage="default.html">
        <VisualElements
            DisplayName="Application1"
            Logo="images\logo.png"
            SmallLogo="images\smalllogo.png"
            Description="Application1"
            ForegroundText="light"
            BackgroundColor="#000000">
        <DefaultTile ShowName="allLogos" />
        <SplashScreen Image="images\splashscreen.png" />
        </VisualElements>
    </Application>
</Applications>

This is almost entirely intuitive, so I won’t explain. Notice all the links to the images that I had you leave in the project.

Finally, add...

<Capabilities>
    <Capability Name="internetClient" />
</Capabilities>

... which declares a single capability - internetClient. This capability declares that this app will want to be able to access the internet. Without it, HTTP calls outside the application would be blocked. In this blank app, we don’t actually need to access internet, but we’ll leave this in there since the blank project template does.

That’s it for the package.appxmanifest file.

Now try running your app! You should see Hello World on a big white screen. Exciting isn’t it. You have two files in your project and already you have a working, albeit boring application.

Let’s keep moving though and work up to what the blank project template offers. It’s not a lot further we have to go.

Sign your application...

The blank template contains a .pfx file. That is a Personal Information Exchange file that allows for release signing. To generate it double click on your package.appxmanifest file. Then go to the Packaging tab. Then hit Choose Certificate next to the Publisher field. Then I just chose to create a test certificate. As you can see the .pfx file is automatically created for you.

Here’s a snapshot of your Solution Explorer again...

image

Add the WinJS styles and scripts to make it a Metro app...

Our app runs and shows “Hello, World!”, but it looks more like a web page than like a Windows 8 Metro style app. We just need to bring in some script and style sheet references in order to make this look and act like a Metro app. Those references are inside of the WinJS library package. To add a reference to that package, just right click on References and Add Reference. Under Extensions, you’ll see Microsoft Windows Library for JavaScript SDK (at version 0.6.0.0 as of this post). Add that.

There are three references we want to make.

  1. ui-dark.css - gives us the black background color, white foreground color, and a lot of Metro style rules
  2. base.js - gives us a lot of core functionality in WinJS like classes and namespaces and such
  3. ui.js - gives us a ton of UI functionality like animations and visibility control

Keep in mind that these dependencies are not entirely necessary. If you bring a web application into Metro it obviously won’t have them and it won’t need them until the first time you want to use something from WinJS. In fact you can still even call into the WinRT without these references, but if you’re making an application for Windows 8. then you probably want to use WinJS. There’s no real reason not to.

To add references to these three files, here’s what we do. Just add these three lines inside the <head> element of your default.html file...

<link href="//Microsoft.WinJS.0.6/css/ui-dark.css" rel="stylesheet">
    <script src="//Microsoft.WinJS.0.6/js/base.js"></script>
    <script src="//Microsoft.WinJS.0.6/js/ui.js">
</script>

Note that the values for the href and src attributes start off with “//”. If you leave the scheme off of the URL here then the assumed scheme is “ms-appx” which means “this package”. So “//” is equivalent to “ms-appx://”. Then when specifying the domain, you have the option of using the name of a package (in this case “Microsoft.WinJS.0.6”). So these lines are referring to the ui-dark.css, base.js, and ui.js files from the WinJS package.

Now run your application and note that it looks very Metro indeed.

Add your own style and script files and references...

If you are going to style anything on the default.html page, you’ll need a style sheet. By convention, we put the .css files into a css folder and we create one for each page. So let’s create a css folder and create a default.css file in it. Also, you’re going to want to write some JavaScript as well. Again, by convention we put .js files into a js folder and create one for each page. So we’ll also create a js folder and create default.js in it. Here we are...

image

The CSS style sheet that we created came with a single style tag for the body. The blank template has something more, so lets add and explain. Add this to the default.css after the body style rule...

@media screen and (-ms-view-state: fullscreen-landscape) {
}

@media screen and (-ms-view-state: filled) {
}

@media screen and (-ms-view-state: snapped) {
}

@media screen and (-ms-view-state: fullscreen-portrait) {
}

These are called media queries, and they are super nice. Media queries allow us to specify different styles for the different view states our application might be in. If you can control the look and layout of your app with CSS alone, then you don’t even need to write any code for when the user rotates his tablet or snaps your app. There is an event for when the layout changes, however, for when you need to write code.

We’ll need  references to our new .css and .js files in default.html too. Adding this to the <head> element (under where you have the WinJS references) should do it...

<link rel="stylesheet" type="text/css" href="css/default.css" />
<script type="text/javascript" src="js/default.js"></script>

Write the application lifecycle and event script...

The last thing we need to do is write some JavaScript to handle the basic application lifecycle and events. We don’t have a separate App entity in HTML/JS like you would have in a XAML/C# app. Instead, this logic goes into the default.js file and it’s quite simple. We’ll take it one step at a time.

First, open default.js. It’s completely empty. Here’s a snapshot of what a completely empty file looks like...

image

Nice, eh? Like a polar bear in a snow storm.

Now, in order to stick with a fundamental JavaScript pattern called the modular pattern, we’re going to start by writing an anonymous function...

function() {}

This function has no name. That’s why we call it anonymous. And so far its body is empty. We want the code in this function to execute though. We don’t want to just declare a function. We want it to go. So we do this...

(function() {

})();

Note that we have simply wrapped the function in parentheses and then put a football (the two calling parentheses) at the end... plus a semicolon for good measure. This effectively declares and calls our function all at once. Actually, first it declares it and then it calls it.

The reason we do this (and this is why the modular pattern exists) is because then the stuff we do inside our function is scoped to the function. If we declare a variable, it is only available inside that function. This is good because otherwise any other part of the application (including 3rd party libraries you might want to bring in) that tried to use the same variable name would have a collision and would get really angry.

One more thing we add is a “use strict” directive to tell Visual Studio we want a little help making sure we don’t accidentally to silly JavaScript wizardry like use a variable we having yet declared or the like. Here’s that...

(function() {
    "use strict";

})();

Inside that function now, we want to handle some application events. The blank template actually defines just two, but I’m going to do a third for your benefit.

We’re going to be referring to the application by using WinJS. We do that by using WinJS.Application. But we don’t want to have to type that out every time, so we can effectively give it an alias by adding...

var app = WinJS.Application;

Now we can just use app instead of the whole thing. I guess you could sort of compare it to a using in C# except that it doesn’t import a namespace. It only gives one an alias.

We’re ready to write our application events. These go inside the function we’ve been talking about...

app.onactivated = function (eventObject) {

};

app.oncheckpoint = function (eventObject) {

};

app.onready = function (eventObject) {

};

You can probably guess about onactivated and onready. onactivated fires when the app is started from scratch or when it revived from a suspended state. onready fires whenever you request the default page. And then we need to add one more line...

app.start();

This... um... well, it starts the app. :)

So all together, you’re default.js should look like this...

(function() {
    "use strict";

    var app = WinJS.Application;
    app.onactivated = function (eventObject) {

    };

    app.oncheckpoint = function (eventObject) {

    };

    app.onready = function (eventObject) {

    };

    app.start();
})();

And if you want to test the onready event for instance, try adding this line inside...

new Windows.UI.Popups.MessageDialog("ready").showAsync();

The blank application further breaks down the onactivated event with this code...

var a = Windows.ApplicationModel.Activation;

if (eventObject.detail.kind === a.ActivationKind.launch) {
    if (eventObject.detail.previousExecutionState !==
        a.ApplicationExecutionState.terminated) {
        // TODO: This application has been newly launched. Initialize
        // your application here.
    }
    else {
        // TODO: This application has been reactivated from suspension.
        // Restore application state here.
    }

    WinJS.UI.processAll();
}

Actually, I added the var a = ... there just to make it shorter, but the point here is to detect whether the application is being launch anew or resuscitated.

And there you have it. You should now be at the functional equivalent of the blank application, but you’ve done it all yourself. You can’t claim ninja status yet, but you can have a yellow belt.

Copyright (c) Microsoft. All rights reserved. The code provided in this post is licensed under the MS-Limited Public License

Tags:

Windows 8

Good Design for App Bar Button Placement

by Jeremy Foster 21. May 2012 08:44

I’ve watched a few developers port their existing apps over to Windows 8.

The first thing they do is drop all of their UI into their new app and run it to see it work. It’s nice to see things work, but Windows 8 is more than just a new API for accessing modern computer hardware. It’s a completely new design for user experience as well. So after you drop all of your buttons into your new app and see it work, you should migrate most of those buttons to the app bar.

The app bar, for the uninitiated, is the bar that slides up from the bottom of the screen whenever the user swipes up from off screen (and sometimes it appears all on its own). That app bar is nice. It avoids bothering the user by appearing only when the user requests it.

Here are some questions that developers raise when they’re learning to design and develop for Windows 8...

  1. Why can’t I put my buttons on the screen like I always have?
  2. Okay, fine, but which buttons should I put in the app bar and which should remain on the canvas?
  3. Do I put the buttons on the left, the right, or what?
  4. What if they don’t all fit?
  5. How do I control when buttons appear?

I’ll take these one at a time...

Why can’t I put my buttons on the screen like I always have?

It’s because it’s 2012 now! The modern trend has been to cram as much information into a user’s screen as possible, but we’ve had enough! When I see so may things I cease to see anything. It’s time to take a step back, take a deep breath, and think about what the user is actually doing right now and dedicate every pixel on the screen to it, immersing the user.

Look at the website versus the Metro versions of the Times of India...

image

image

Most of the space in the website version is taken up with navigation commands (hyperlinks), which is a good example of an app telling you about “where you might go” instead of telling you where you are and letting the user navigate with the content.

Okay, fine, but which buttons should I put in the app bar and which should remain on the canvas?

First off, most of the buttons should be in the app bar. It won’t take long for a user to learn that that’s where the interactions are and start to swipe that bar up automatically. Since the app bar is hidden at first (usually), many wonder if their command won’t be apparent enough to the user. Keep in mind, however, that when a user draws up the app bar, they are specifically searching for a command. It takes away the need for discoverability and arguably makes your command more apparent - not less.

Some buttons should be on the canvas though. You would decide to put a button on the canvas when it’s part of the workflow a user is traversing. A case could be made that the workflow itself is the content at that point. If I’m adding products to my cart and checking out, I’m not here to browse content anymore. I’m engaged in the purchasing workflow. If you’re a retailer making a Windows 8 app, I would recommend that you diligently immerse the user in your products and their supporting media to make them love the browsing experience. Then when they decide to checkout, transition them to a slightly more utilitarian mode with canvas buttons and progress feedback.

Do I put the buttons on the left, the right, or what?

In general, the right side is for global commands, and the left side is for contextual commands. There are exceptions, however.

Global commands are those that apply to the entity represented by the current page. If you’re on the friend page, then add to favorites is a global command because it applies to the friend.

Contextual commands are those that apply to the entity or entities the user has selected. If you’re on the my friends page, then add to favorite is going to require that you swipe select one or more friends and would then be a contextual command.

One exception to this is when you don’t have any (and aren’t going to have any) contextual commands because you have nothing for the user to select. In this case, the entire app bar can be dedicated to global commands and the left and right sides should be used to separate the most disparate functions. You could, for instance, put your filtering commands on the left and your sort commands on the right.

What if they don’t all fit?

If you have more commands then you have app bar, then go vertical by combining commands into menus. For instance, if this is what you have on your app bar...

image

...then combine all of your filters into one menu and your sorts into another. That would bring 9 buttons down to only 4!

How do I control when buttons appear?

If you’re using HTML/JavaScript for your app, the recommended way to add app bar buttons and control when they appear is to declare them all on the default.html file and then in the .js file for each page just control their visibility. This avoids having to manipulate the DOM each time a page is loaded. There are easy functions for doing this such as...

appbar.showOnlyCommands(["add-template-item","delete-global"]);

If you’re using XAML/C# then (from what Jerry Nixon tells me), you will actually create the app bar buttons on the page where they’ll appear.

Finally, don’t forget to account for snap view. When your app is snapped, you only have room for 5 app bar command buttons. If you have more then they will wrap up to a second row and it will look funny and your users will laugh at you. And that’s not the response you’re likely looking for.

Happy commanding!

Tags:

Windows 8

App Accelerator Resources

by Jeremy Foster 17. May 2012 16:44

To everyone who joined @mjconnection and I (@codefoster) at the Windows 8 App Accelerator the last 3 days, thanks for bringing all the energy, questions, and app ideas! I know I had a great time.

I promised everyone that I would provide a list of resources that we brought up in class. If you think of any more that I missed, feel free to leave it in a comment and I’ll merge it into this list.

Keep me posted on the progress of your apps!

Metro Tile Sources

The Noun Project  - this is a great collection of icons that represent things… you know nouns
Icon Finder  - find icons on the web and get either the PNG or the ICO file
Icons8.com - a cache of free glyphs that work well with Windows 8 Metro style tiles and art
The XAML Project  - more
SyncFusion Metro Studio - more
http://raphaeljs.com/icons/ - more

Visual Studio Add-Ins

Debugger Canvas  - use this to visualize your code and your call stack while you’re debugging. It even supports visualization of multi-threaded stacks and recursive functions.
Bug Aid  - some more great help visualizing C# entities while you’re debugging
ReSharper 7 EAP - perhaps the biggest source of developer joy you can ask for

Art Tools

Inkscape.com - this is an awesome vector based graphics tool. If you’re still using a bitmap based image editing tool for generating app art, you should stop in your tracks and learn to use vector.
Kuler - a color palette picker.
ColourLovers.com   - again
colorschemedesigner.com - again

App Stats

None of these support Windows 8 yet of course, but they were mentioned in class so I thought I should include them…

App Annie
Distimo

Other

txt2re.com 

Tags:

Windows 8

Windows 8 Camp Content

by Jeremy Foster 13. May 2012 13:01

I presented three sessions at the Windows 8 Camp in Redmond on May 11, 2012. The content is included below for your reference.

If you want to learn more about designing Windows 8 apps, be sure and attend the App Accelerator labs that are going to be on campus next Tues thru Thur. For more information, go to msdnevents.com.

Session 1 - Metro Design Language

A lot of the strength of Metro style applications on Windows 8 comes from the consistency of the design principles. It’s not enough for a developer to create an application that functions correctly. Applications should be designed to delight the user. You can find a lot of help at http://design.windows.com.

The content that I delivered at the camp on May 11 was an abbreviated version. The longer version in video form can be found at http://sdrv.ms/DesignBeforeYouDevelop. I also have another blog post on the subject.

Here’s the abbreviated slide deck that I delivered on May 11…

image Slide deck

Session 2 - Using Visual Studio 11 and Blend to Create Metro Apps

The latest iteration of Visual Studio has a lot of love poured in. From a .NET framework with a 40% smaller install footprint and multi-threaded garbage collection… to the new await keyword in C#… to the much acclaimed WebAPI! But if you’re looking at developing Metro applications, then you’re going to love features like the new Metro app templates, the simulator, and the DOM explorer.

Just like Expression Blend was the visual designer for XAML UI components, now Blend is the designer for Metro style applications. Blend is revolutionary in that it lets you design while your app is actually executing. No more need for sample data or wondering what your app is going to look like live… it’s always live!

image Slide deck

Session 3 – Developing Metro Apps Using JavaScript

In this session, we saw the basics of creating Metro applications using HTML5, CSS3, and JavaScript. We added event handlers, controls, and navigation and we fetched local and remote data and used it to populate the default grid application. There’s also some basic data binding in there.

I think the code is fairly clean and concise, so hopefully it will help you come up to speed on app development. Good luck.

image VS11 Solution: Metro App Development with JavaScript

Tags:

Windows 8

Get An App Into the Windows 8 Store

by Jeremy Foster 10. May 2012 11:22

As you likely know Windows 8 is coming in the near future. You can download, use it, and even develop apps for it today. At this point in time, the Windows Store is not open for everyone to deploy, but we are looking for the first wave of great applications which highlight the power of Metro and Windows 8, especially those developers that want to get to market first and build the awareness and brand for their applications.

In order to submit your application today, you need a token which is something I can help you get.

What do you need to do to get a token? Here are the key steps:

  1. Create a great application or game and get it ready.
  2. Let me know about it by contacting me via jeremy.foster@microsoft.com
  3. I’ll help you register so you can get your application through our Application Accelerator Labs where the app will get reviewed to confirm it is done and conforms to the Metro guidelines and certification requirements.

This is a great opportunity to not only be first to market with your app, but also to get feedback from a Microsoft Services Engineer to make your app great. If you are serious about creating an application this is a chance that you probably don’t want to pass up.

In addition, our team is holding a series of events and office hours to help you – we want to make sure you have what you need to be successful. You can come learn more about how to build apps for Windows 8 or show up and build your app with one of our evangelists or others in your community available to help you if you need it. You can find more information about our events and availability at…

image

Windows 8 Developer Camps

Redmond, WA (May 11)
Denver, CO (June 1)
Chandler, AZ (June 8)

Windows App Accelerator Labs

Los Angeles, CA (May 8-10)
Redmond, WA (May 15-17)
Mountain View, CA (May 22-24)

Tags:

Windows 8

Query Selector Helper for Metro Apps

by Jeremy Foster 2. May 2012 14:53

I wrote a post sometime back  about selecting DOM elements in your Metro apps. I have since written myself a helper method that I find quite useful and perhaps you will too. It looks like this…

function q(query, context) {
    context = context || document;
    var result = context.querySelectorAll(query);
    if (result.length > 1) return Array.prototype.slice.call(result);
    else if (result.length == 1) return result[0];
    else return null;
}

I just drop it in the global namespace (*handslap*) so I don’t have to worry about qualifying it with a namespace prefix. So, more specifically, I just add it outside of the function on the default.js page, and that makes it available to all of the pages in my app.

The original goal was to make it easier to type then things like…

var fredDiv = document.querySelector("div#fred");

...or...

var allDivs = document.querySelectorAll("div");

But I subsequently decided to combine the selection of single elements and multiple elements. The logic dictates that if multiple results are found, then they are all returned, but if just one is found then that one is returned. Furthermore, you can see that I am turning the NodeList result that comes back in the case of multiple results into a standard JavaScript array using a slice. This way I can use array methods like .map, .filter, etc.

It accepts a context which if it’s omitted will default to the document object. If provided, however, then the selection is done below the DOM element specified. Therefore this…

var allDivs = q("div");

…will find all div elements in the entire document, but…

var footer = q("div#footer");
var childDivs = q("div", footer);

…will find all div elements underneath the div called “footer”.

Use it if you like it. Happy selecting.

Copyright (c) Microsoft. All rights reserved. The code provided in this post is licensed under the MS-Limited Public License

Tags:

Windows 8

Feed Subscribe