Pages

Thursday 27 September 2012

Metro: Creating an IndexedDbDataSource for WinJS


The goal of this blog entry is to describe how you can create custom data sources which you can use with the controls in the WinJS library. In particular, I explain how you can create an IndexedDbDataSource which you can use to store and retrieve data from an IndexedDB database.
If you want to skip ahead, and ignore all of the fascinating content in-between, I’ve included the complete code for the IndexedDbDataSource at the very bottom of this blog entry.

Read More 

Windows 8 RTM JavaScript–Change Lock Screen Image


Windows 8 RTM JavaScript–Change Lock Screen Image
In the past couple of months I’ve worked a lot with Windows 8 JavaScript and C#, I’ve also wrote plenty of posts on that subject and there is much more stuff to talk about.

In this post I’ll show two things:

  • Using File Picker using JavaScript
  • Change Windows 8 Lock Screen Image Programmatically


Read More

Using IndexedDB in your Windows 8 Game

Using IndexedDB in your Windows 8 Game
As I was pulling together my previous post on notifications in an HTML 5 game on Windows 8, I couldn’t help but think there must be a better way to handle the storage of the local leaderboard. If you’re not familiar with that sample, it’s a simple game where you see how many times you can touch a bouncing ball before it hits the boundaries of the display ten times.

Read More

Windows 8–Connecting to SkyDrive


Windows 8–Connecting to SkyDrive
I wrote my first Windows 8 code which connected to SkyDrive the other day so I thought I’d share in case it helps anyone who’s doing a similar thing. The main documentation set for Live is on the web so drop that into your favourites if you’re going to be working with this API set. Simple example – let’s say that I want to grab some pictures from my local machine and upload them to a particular folder on my SkyDrive. I’ll start with a blank project.

Read More

Location Awareness in about 2 minutes with Windows 8–HTML


Location Awareness in about 2 minutes with Windows 8–HTMLI was working on a mapping application for Windows 8 – HTML using the Bing SDK and needed to pass the latitude and longitude into it. I began searching for a straightforward way to get the location and had to read through pages of documentation before finally finding it. Here it is in case you want to use it in your own apps.

Read More

Useful Value Converters For WinRT Development


Value converters are a really useful part of the xaml binding infrastructure, they work in Windows Phone 7, Silverlight and WPF. As we work on more and more projects in this space we build up a library of useful value converters. I'd like to illustrate some of the ones I use here.

  • Bitmap Image Converter
  • Boolean To Visibility Converter
  • Colour To Brush Converter
  • Simple Type Converter
  • String Format Converter


Read More

Windows Store: Two-thousand, seventy-nine


Windows Store: Two-thousand, seventy-nine
Milestones. Every one counts. Sure, the iOS app store has considerably more apps than the Windows Store today – that’s not news.

But developers are adding to the Windows Store every day – and though some apps are removed from the store periodically, the number that grows every day. Today, the Windows Store broke the 2000 app mark and arrived at 2,079 apps available internationally.

Read More

Wednesday 26 September 2012

AdRotator for Windows 8


AdRotator for Windows 8
As battles go this was certainly one of the strangest.  Windows 8 introduces so many different ways of working, some expected and welcome, some not so.

One of the biggest unexpected challenges is that libraries and packages can not longer distribute User Controls as part of a separate dll or class library, if it’s another project in the same solution that’s fine but if you want to distribute a control such as AdRotator this presents a bit of a problem.

Read More

Tuesday 25 September 2012

How to Write a WinJS Custom Control


How to Write a WinJS Custom Control
Lately, I was involved in a few Windows 8 projects. One of the questions that I am being asked from time to time was how to write your own Windows Store app custom control with WinJS library. This post will try to give you a head start for your custom control library. During the post you will build an autocomplete control step by step and learn a few WinJS concepts on the way. So let get started.

Read More

Windows 8 Apps: Change your project to run PlayReady successfully


Today I wasted a lot of time to understand why, the code I wrote to implement PlayReady in a Windows 8 App didn’t work. I have ran the code lot of times, making changes to handle obscure hypothesis, just because my application was failing to load a DRM protected stream. When I finally found the error code issued by the MediaFailed event I went on the right way:

Read More

Windows 8: Windows Store apps - JavaScript passing data to the code containing the WebView control


Over the past few weeks, in my spare time, I've been working on building a Windows Store app that will wrap an HTML web app that I've built. To use the web app, you enter a token in a textbox on the welcome page and then click the Verify button. If the token is valid, a URI is given to the user which can then be used for the tracking of one's time using the start/stop timer view in the web app.

Read More

DESIGNING RETRO LOOKING GAMES FOR WINDOWS 8


DESIGNING RETRO LOOKING GAMES FOR WINDOWS 8
When people talk about “retro” games, they usually refer to most games made for the 1st to 4th generation of gaming consoles. The hallmark of these games are their pixelated visuals and approachable yet challenging game mechanics. I was a huge fan of these games growing up, so most of the ones I make today emulate the visual style and gameplay from this era in gaming history. I wanted to highlight some features of these games and talk about how to recreate them when making your own HTML5 games for Windows 8. Since canvas is perfect for rendering 2D graphics, making a retro-looking game is easy to accomplish and works well on almost any hardware. First, we need to talk about picking an art style.

Read More

Windows 8–Search Suggestions in Charm bar


I recently started a series of postings from my tour of presentations in Europe and the UK.  Today I’d like to return to Searching (which I started to cover here), and this time take a look at what it takes to have your application offer Search suggestions as the user types into the Search box.

To examine this, we’ll create a Windows 8 application with the suggestions hard coded, but you can just as easily obtain the suggestions from a web service, or database, etc.

Read More

Building a project skeleton, using CSS3 layout and styling WinJS controls #Win8Dev


This past week was spent turning wireframes and workflows into a moving prototype using static data. Not only does this action of sketching out the project inform architecture, but it also allows us to create the placeholders once we get the visual design.

As a bonus, a short screen cap of the prototype can be a valuable asset while the app concept is still forming in our heads.

Read More

Thursday 20 September 2012

Ways You can Leverage Share Contracts in your Windows Store Game


Ways You can Leverage Share Contracts in your Windows Store Game
One of the great new features available to developers creating Windows Store games is the Share Contract. The Share Contract, or sharing, provides an easy way for you to share data from your game to other applications the user has on their system.

Why is sharing useful? Games are, by their nature, social. Perhaps you are starting to play a game of Ultimate Zombie Battles and you want to let your friends know you are playing so they can come join you. You may want to let the world know that you just achieved a personal high score on Find the Chicken. Or better yet, you just downloaded a new game and you think it is so cool, you want to let your friend and family know about it so they can play it too.

Read More

Ways You Can Use the Search Contract in Your Windows Game


Ways You Can Use the Search Contract in Your Windows Game
The Search contract is a way you can integrate the Windows 8 search experience into your game. Windows 8 provides a Search feature that is enabled via the Charm bar (shown at right). The Charm bar is activated by a user swiping from the right edge of the screen with a finger, or by either a mouse or keyboard action (mouse to the upper right corner of the screen or Windows+C ). From the Charm bar, the user can select the Search charm and enter the default Search experience.

Read More

What is the difference between a company vs. individual account for the Windows Store?

When you register to develop apps for the Windows Store, you have the option to register for a company or an individual account.  What are the major differences between them?

Read More

Standard AppBarButton Styles Revealed For Windows 8 RTM


Standard AppBarButton Styles Revealed For Windows 8 RTM
As much for my own benefit as anyone else’s here are the icons that all exist within the “Segio UI Symbol” Font referenced in the Standard Styles XAML fragment of every new project.  (They should form the basis for any icon appearing in the Application Bar)

With thanks to Long Zheng for providing source code for easily  rendering the icons:
Read More

How to measure rendered string dimensions in #Win8Dev


While Windows 8 WinRT supports ViewBox control (its a control that allows text to auto resize depending upon available space), with my alarm clock app, I noticed substantial jittering (and resizing) as time changes between seconds. Of course you don’t want that happening.

Read More

Getting started with SQLite in Windows Store / WinRT apps


Getting started with SQLite in Windows Store / WinRT apps
In this blog post I will expand the blog post by Tim Heuer  to include information on how to include and access a pre-populated SQLite database file, maybe even a file created by migrating from a SQL Server Compact database file, as I blogged about recently.

First, download the "SQLite for Windows Runtime" Extension via Tools/Extensions and Updates/Online. Restart Visual Studio.

Then add references to the SQLite and C++ extensions as described by Tim Heuer. Remember to change the Build Configuration to either x64 or x86 in Configuration Manager.

Read More

Video Tutorial : Creating Windows 8 Metro App to work with Picture Library (WinRT, XAML and C# )


Some time back, I created a small Windows 8 Metro Application (Windows Store App) which can access the Windows Picture Library and display thumbnails of all the pictures available in it. This post should be of a little help for developers who just started exploring Metro Apps for Windows 8.

Read More

Tuesday 18 September 2012

How to draw driving route direction with Bing maps in C#/XAML Windows 8 app


How to draw driving route direction with Bing maps in C#/XAML Windows 8 app
In one of my app, I have to give feature of drawing route direction with Bing maps. I found an example in JavaScript, but I want the same in C#/XAML. So Richard Brundritt helped me by providing the Bing Maps REST Service helper class, with that I managed to do it. Here I am posting the code. All REST links URL Templates cam be found here. Thanks to Richard Brundritt :)

protected async override void OnNavigatedTo(NavigationEventArgs e)
{
    Uri geocodeRequest = new Uri("http://dev.virtualearth.net/REST/V1/Routes/Driving?o=json&wp.0=28.608280181884766,77.200813293457031&wp.1=19.072799682617188,72.882598876953125&optmz=distance&rpo=Points&key=YOUR_BING_MAP_KEY_HERE"); //Route Ahmedabad to Mumbai

    //Make a request and get the response
    BingMapsRESTService.Response r = await GetResponse(geocodeRequest);

    MapPolyline routeLine = new MapPolyline();
    routeLine.Locations = new LocationCollection();
    routeLine.Color = Colors.Blue;
    routeLine.Width = 5.0;

    int bound = ((BingMapsRESTService.Route)(r.ResourceSets[0].Resources[0])).RoutePath.Line.Coordinates.GetUpperBound(0);
    for (int i = 0; i < bound; i++)
    {
        routeLine.Locations.Add(new Location
        {
            Latitude = ((BingMapsRESTService.Route)(r.ResourceSets[0].Resources[0])).RoutePath.Line.Coordinates[i][0],
            Longitude = ((BingMapsRESTService.Route)(r.ResourceSets[0].Resources[0])).RoutePath.Line.Coordinates[i][1]
        });
    }
    MapShapeLayer shapeLayer = new MapShapeLayer();
    shapeLayer.Shapes.Add(routeLine);
    MyMap.ShapeLayers.Add(shapeLayer);
}


private async Task<Response> GetResponse(Uri uri)
{
    System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
    var response = await client.GetAsync(uri);
    using (var stream = await response.Content.ReadAsStreamAsync())
    {
        DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Response));
        return ser.ReadObject(stream) as Response;
    }
}


Monday 17 September 2012

Data Presentation In HTML5/WinJS Metro App


Data Presentation In HTML5/WinJS Metro App
Inevitably, you’re going to have to make a choice about what control underlies this presentation of data, and eventually you’re going to have to implement it.

In this post, I’d like to do a little bit of a study into what control to choose when and why. As usual, I’ll be coming from an HTML/JS perspective, so if you’re wondering what your options are in XAML, Bing is your friend.

Read More

Creating an inline AppBar Button Style for your Win8 apps


Creating an inline AppBar Button Style for your Win8 apps
As you have probably read, the Metro Windows Store projects in Visual Studio now comes preloaded with a ton of styles for your AppBar. I love this style of button. You get the nice icon and text to indicate what the icon is supposed to mean (sometimes the icon can be confusing). Having both the icon and the text removes the need for users to hover over an icon to see what it’s suppose to be.

As awesome as the style is for buttons on the AppBar, they do have some limitations. They are big, and the text is on the bottom. This design makes it hard to put this style of icon in other parts of your app. Take a look at the Games app. Go all the way to the left and you’ll see your avatar along with ways to do more with your Xbox account. You accomplish these actions with buttons that look a lot like the AppBar buttons.

Read More

Authenticating an ASMX Web Service in SharePoint from a WinRT app


Where’s the CookieContainer?

Yes mate, I’ve had that question too.

We are creating a new application for Windows 8 and we need it to connect to our web services. Connecting to the anonymous methods was easy, but when it comes to authenticating the user the situation changes.

Read More

MetroLog - A lightweight logging system designed specifically for Windows Store and Windows Phone 8 apps


MetroLog is a lightweight logging framework designed for Windows Store and Windows Phone 8 apps. Although the API is based on NLog and log4net, the intention is that it's a very basic logging system.

The need for it to be basic comes from the fact that the Windows Store apps API surface area intentionally limited for very specific applications. This project came out of the fact that porting NLog to Windows Store apps is difficult because of it's incredibly rich feature set, most of which is not workable in Windows Store apps.

Read More

Sunday 16 September 2012

Windows 8, XAML and Displaying Multiple Sized Items

One of the common layouts that you see in Windows Store applications is one that looks a little like the one below.
Windows 8, XAML and Displaying Multiple Sized Items


Want to get like this UI for your app, read more here

Referring to Package Files

When you’re working with a Windows 8 project in VS2012, you have some number of project files in your Solution Explorer. You have HTML files, CSS files, JavaScript files, images, and perhaps some XML or JSON or TXT files - something like that.

If, in the course of executing logic in your app, you need to access these files, there are a number of ways and you should know when you might use what and why… that’s as opposed to being incapacitated or stabbing in the dark.

Read More

Parsing CSV Files in WinRT

I am proud to announce that my CSV Parser for Windows RT is now available on MSDN Code Samples. Creating a CSV parser sounds like an easy task, but it’s the developer equivalent to quick sand. CSV stands for Comma Separted Values and, despite the name, the files in this "format" are often not fields separated by commas. Often, tabs or pipe characters are used instead. Additionally, parsing a CSV file is not as straightforward as it seems. One would think that it would be as simple as splitting the raw text first by line to get the records and then by delimiter to extract the fields.

Read More

Inspecting local and roaming settings for Windows 8 Store app

Inspecting local and roaming settings for Windows 8 Store app
ApplicationDataContainer class supports saving of complex hierarchies of local and roaming settings. Sometimes there is a need to verify saved values but unfortunately Windows 8 development toolset doesn’t include any settings inspector. This post describes a method for inspecting settings manually.

Application settings are stored in C:\Users\<user_name>\AppData\Local\Packages\<package>\Settings\settings.dat. settings.dat is a Windows NT registry file (REGF) and includes local and roaming settings. This file format, REGF, also known as Registry Hive File, is supported by Registry Editor.

To open settings file, close your app and open Registry Editor. Than select HKEY_LOCAL_MACHINE or HKEY_USER and open Load Hive dialog from File menu.

Read More

NFC on the Windows 8 Platform

NFC on the Windows 8 PlatformThe Proximity APIs enable you to create NFC apps for the Windows 8 platform. Designed to be easy to use and streamlined for the most common use cases, the APIs allow integrating powerful features into your apps in a very short time.

At the NFC Congress in Hagenberg, Austria, we’ve just presented the first overview of those APIs during our Developer Workshop that was opening the conference.

Read More

WrapPanel for Windows 8 WinRT

Out of the box, there's no WrapPanel available for WinRT. There's the VariableSizedWrapGrid, which you can use. But it doesn't work well with items that have different sized. Each item in the grid gets sizes based on the dimensions of the first item. You can see this behaviour in action here:

Searching for a good WrapPanel, I found one for Silverlight 2. Silverlight 2 did not have a native WrapPanel, so an open source WrapPanel was created by "Ineir":

Read More

Saturday 15 September 2012

Windows 8: Windows Store apps and the WebView control


I recently started looking into creating a simple Windows 8, Windows Store app, that would contain a browser window and a setting somewhere to allow the URI to be modified.

The app itself is quite simple in concept so I figured it would be a breeze to implement for Windows 8.

To display a web page I needed to use a WebView control and I simply set the Source property to the desired Uri.

Read More

Friday 14 September 2012

No more SkyDrive file type restrictions

As more and more developers have been building Windows 8 apps, they've appreciated the Windows 8 file picker integration with SkyDrive and wanted us to similarly make it simple to integrate a SkyDrive file picker with their websites.

Based on this feedback, we recently released an update for the SkyDrive developer experience to
  1. Remove all API restrictions related to photo resolution and content types
  2. Provide a new, easy-to-use file picker API for websites (similar to our file picker for Windows 8 apps)

We're seeing many apps take advantage of these updates to unlock new possibilities.

Read more

Telerik Windows 8 UI Controls Release Candidate – Build Windows Store-Ready Apps at No Cost

Telerik Windows 8 UI Controls Release Candidate – Build Windows Store-Ready Apps at No Cost
Today we are pleased to announce the Release Candidate of Telerik UI Controls for Windows 8 development. One of the highlights of the release is the addition of two new controls, Pagination  and HubTile, for both HTML and XAML environments. In addition, the suite gets improvements such as Design-time support for XAML and numerous performance enhancements.

With this version of the suite (as well as with the previous Beta) you can build Windows store-ready apps at no cost. Hurry up, get your app to the store first; being first has huge advantages! There are already a number of certified apps on the Windows Store using the Telerik Windows 8 controls.

Read More

Building Office for Windows RT

Building Office for Windows RT
Editor’s note: Earlier this year, Steven Sinofsky announced Windows support for ARM processors (Windows on ARM or WOA). His post on the Building Windows 8 blog included the following news about Office:

    “WOA includes desktop versions of the new Microsoft Word, Excel, PowerPoint, and OneNote. These new Office applications, codenamed “Office 15”, have been significantly architected for both touch and minimized power/resource consumption, while also being fully-featured for consumers and providing complete document compatibility.”

In the months since that announcement, there has been a great deal of speculation about what we are delivering. David Brodsky, Partner Test Manager and Josh Pollock, Principal Development Manager join Office Next to walk you through what Office for Windows RT is and why it exists; specific optimizations we’ve made (and why most of those will benefit you on other platforms too); what wasn’t possible and the functionality differences that resulted; and finally how to get Office Home & Student 2013 RT.

Read More

Windows 8: Binding a ProgressBar to a long running Task

A really common scenario in a Windows 8 / WinRT app (or any app) is to load data from the web or do some other action that takes a while to complete. While loading our data, we also have to update the UI to show some sort of loader so the user knows a bunch of data is being loaded.

With Windows 8 and the Async / Task model it's really easy to do asynchronous task on another thread and not block the UI. But how do we show the user what's going on with the long running task?

Read More

Adding and Editing WinRT Behaviors with Blend

I am a huuuuuuge fan of Behaviors (and Actions and Triggers) for Silverlight and WPF. I have been very disappointed when WinRT turned out not to support them.

Luckily, Joost Von Schalk created WinRTBehaviors on CodePlex (also available on NuGet). But his solution still lacks any Blend support. I have not been able to reproduce the full Blend behavior editing experience, but I managed to take the first baby-step that at least saves you from creating Behaviors from code.

Read More

Windows 8 Colors (HEX code)

Windows 8 Colors (HEX code)
In my own projects I really like to have correct colors. With Windows 8 coming out, more and more of my projects are around Windows 8. I’m not much of a designer, but sometimes I like to play pretend. I was able to grab these colors from Windows 8 RTM. I’m only including the HEX code because RGB would have been a pain to copy from the programs I use. If you need RGB, there are lots of HEX to RGB color converters online. I hope you find these useful!.

Read More

Building Data and Services for Windows 8 Apps


In this post, I'm going to kick off a series in which I'll walk through the creation of a back-end service for a Windows 8 app. This first post will provide an overview of the series, and introduce a couple of potential technologies you can use to build your back-end services.

The Challenge
As an example of a scenario that might merit a nicely abstracted back-end service, I'm going to create a simple leaderboard service that can store and retrieve high scores and win/loss/tie stats for a variety of games. Since it's where I've spent the majority of my time lately, I'm going to focus on games built with HTML and Javascript, but the platform choices I'm going to describe will work just as well for games and apps build with C# or VB and XAML..

Read More

Thursday 13 September 2012

Integrating your cloud service with the file picker contracts


Integrating your cloud service with the file picker contracts
In the past, users organized, shared, and maintained their documents, photos, videos, and music on the local PC. But the cloud is quickly providing users with much richer ways to access, experience, and manage the files they care about. Windows 8 embraces these new scenarios by allowing you to deeply integrate cloud services directly into your apps to create completely new experiences that were not possible before.

You can see many of these scenarios highlighted in the SkyDrive app which uses the file picker contracts. The file picker contracts are designed to make user’s documents, photos, videos, & music stored in your app available to all other Windows 8 apps. In this post, we use the SkyDrive app (which implements all three of the file picker contracts as introduced in Connecting your apps, files, PCs and devices to the cloud with SkyDrive and Windows 8) to show you:

Read More

Searching in Windows 8 Thorough Charm Bar


Searching in Windows 8 Thorough Charm Bar
Windows 8 Store Applications can take advantage of the shared “Charms” that you see when you swipe in from the right edge of your Windows 8 device (or press Win-C).  The top charm is searching and it provides tremendous functionality at relatively little programming effort.

When you click search Windows 8 assumes you want to search the current application if that application has registered a Search “contract.”  If it has not, Windows 8 will assume you want to search the applications, as shown in the figure (click on the figure for full size).

Read More

Code Snippets for Windows Store Apps


In partnership with the Visual Studio team, we are launching Code Snippets for Windows Store apps, a collection of around 60 IntelliSense Code Snippets for common Windows Store app programming tasks. The snippets are available for Visual Basic, C#, C++, and JavaScript developers.

For example, if you don’t know how to copy a file in JavaScript or C++, just right-click, select Insert Snippet, select the code snippet, and it will automatically add the code to your Windows app as shown in the screenshots below.

Read More

How to market yourself with your windows 8 app quickly


This article was inspired by a prominent Silverlight MVP and evangelist Kunal Chowdhury who wrote a nice little post on how to market your WP app better – http://bit.ly/SDtMd0

So seeing this I couldn’t help to quickly morph his article to fit Windows 8, what becomes obvious as you compare the two is that there are so many things that are just basically easier with Windows Phone, hopefully the Windows 8 API will mature more over the coming months. (will be even more interesting when the WP8 SDK is revealed if they have stayed true to their roots or move to a more Win 8 route # shudder)

Read More

Exporting an image from a DirectX 2D Image in Windows 8 C#/XAML Using SharpDX

I’m working on a Windows 8 app which has a drawing element to it. The original WP7 app in Silverlight was fine because a simple drawing rendered in XAML was captured using WritableBitmap.Render and written to a file stream. This feature is missing from the Windows 8 API, so it’s impossible to write a pure C#/XAML app which can export a user created image. To get round this it’s possible to use DirectX/XAML/C++ to create a XAML UI which can draw DirectX images.

Read More

Wednesday 12 September 2012

5 points developers should know about WinRT/Windows 8

5 points developers should know about WinRT/Windows 8
Most of us already started developing for WinRT, so it make sense to have a better understanding of the run time. I am listing down few points with respect to WinRT, mainly from a developer’s perspective.

Read those 5 points here

Getting started with Metro Elements: Chart controls

Getting started with Metro Elements: Chart controls
Not long ago we released the beta version of Metro Elements – a suite of controls for WinRT. Currently we provide a set of powerful charting controls and a date-time picker with flexible formatting. We also have many more controls currently under development which will be released throughout the next couple of months. In this blog post I’m going to walk you though getting started with using Metro Elements. In particular, we will look at adding a couple of charts to an application and populate them with data. If you would like to follow along but don’t have the beta yet, you can download it for free from here.

Read More

Create an Appointment Tracking App with RadDatePicker & RadTimePicker

Create an Appointment Tracking App with RadDatePicker & RadTimePicker
We all have a variety of uses for collecting Date and Time information from a user. For example, tracking the time a patient arrives and departs from a hospital, to when a car was returned at a local car rental location to tracking expense reports. One of the controls that you may have found missing with Windows 8 XAML applications is the Date/Time Picker control. While the control exists for Windows 8 HTML Applications, it is very limited in its initial state. That is one of the reasons that Telerik has decided to make a more robust Date/Time Picker control and in this blog post we will explain how to use it in a simple app that keeps track of important appointments. So buckle up and let’s get started.

Read More

Using WinJS & WinRT to build a fun HTML5 Camera Application for Windows 8 (2/4)

using WinJS & WinRT to build a fun HTML5 Camera Application for Windows 8 (2/4)
Using WinJS & WinRT to build a fun HTML5 Camera Application for Windows 8 (1/4)

In this second tutorial, we’re going to add support for video recording. The first step will then to work on the UI to let the user choosing between photo & video mode. Then we will add the JavaScript code that will let you recording some videos. Finally, we will add a cool slide effect with CSS3 animations to provide a visual feedback to the user while taking some photos/videos. As a reminder, this tutorial is part of this series:

Read More

Windows 8 App Challenge: Microsoft Australia giving away 50 x $1,000 Windows RT tablets


Windows 8 App Challenge: Microsoft Australia giving away 50 x $1,000 Windows RT tablets
Australian developers, start your Windows 8 app engines.

Attendees of the Microsoft TechEd Australia 2012 conference over the next couple of days will have the opportunity to win one of 50 Windows RT tablets for submitting three Windows 8 apps to the Windows Store by October 1.

The $50,000 AUD contest (50 x Windows RT tablet each worth $1,000) starts today on September 10 and closes three weeks later on October 1. During this time, the developer must create an Australian Windows Store account, submit three Windows 8 applications, complete a virtual lab session and email Microsoft Australia with their apps.

Read More

The Windows Store Submission Process


The Windows Store Submission Process
I recently got access to the Windows Store, and submitted my first app, “The game of Bao”, a simple and fun board game I learned when we visited Malawi, Africa during our honeymoon (any money the game makes will be donated back to an organization working on improving the lives of the kids that taught us this game, so please be kind and play it a lot and give some great reviews :-).

I recorded the steps that I have had to go through so you can see what you need to have ready if you need to submit an app yourself.

Read More

WinRT: Creating an Image Collage in C#


WinRT: Creating an Image Collage in C#
Collage - is a technique of art production, primarily used in the visual arts, where the artwork is made from an assemblage of different forms, thus creating a new whole. ~ Source Wikipedia

I imagined the process would be straightforward but the fact is I found a couple of gotchas that I was able to overcome eventually. In this post, we will see how we can stitch together a series of images to build a collage. Let’s jump right in.

Read More

How to find an element in a DataTemplate in WinRT/XAML


Here’s one way to find a named element in a DataTemplate in XAML in Windows 8 XAML.

You might try FindName to discover it doesn’t work. That’s because it’s not recursive.

So, I created a simple extension method to do the same thing

Read More

Windows 8 Apps With HTML5 Published in Visual Studio Magazine (September 2012)


Windows 8 Apps With HTML5 Published in Visual Studio Magazine (September 2012)
I have a new cover story article published in print and online in Visual Studio Magazine today called, “Windows 8 Apps With HTML5”. If you're an experienced Web developer, you'll love the new Windows Store options to use HTML5/JavaScript/CSS3 to build an application that works in the Windows 8 UI. Here's a step-by-step guide to getting started.

See below for more information and a link to the online article in case you don’t get a print copy.

Read More

Tuesday 11 September 2012

Consuming the Amazon S3 service from a Win8 Metro Application


Consuming the Amazon S3 service from a Win8 Metro Application

As many of the existing Http APIs for Cloud Services, AWS also provides a set of different platform SDKs for hiding many of complexities present in the APIs. While there is a platform SDK for .NET, which is open source and available in C#, that SDK does not work in Win8 Metro Applications for the changes introduced in WinRT. WinRT offers a complete different set of APIs for doing I/O operations such as doing http calls or using cryptography for signing or encrypting data, two aspects that are absolutely necessary for consuming AWS. All the I/O APIs available as part of WinRT are asynchronous, and uses the TPL model for .NET applications (HTML and JavaScript Metro applications use a model based in promises, which is similar concept).

In the case of S3, the http Authorization header is used for two purposes, authenticating clients and make sure the messages were not altered while they were in transit. For doing that, it uses a signature or hash of the message content and some of the headers using a symmetric key (That's just one of the available mechanisms). Windows Azure for example also uses the same mechanism in many of its APIs.

Read More

Friday 7 September 2012

Code Contracts tab in VS2012 – Odd way to get it enabled


Code Contracts tab in VS2012 – Odd way to get it enabled
I am a huge fan of the Code Contracts library which is now part of .net, in fact when I setup a new instance of VS it is one of the first plugins I install by default.  However, I was having some issues because even though I had installed the .msi I was not able to get the settings tab to show up in VS2012, in fact it was not in VS2010 either.  This was a bit odd to me because I had never had this issue.

In order to try to resolve this I decided I should uninstall the .msi and re-install it, so I set out to do this.  However, after doing this I still did not have the tab in either IDE, now I was perplexed.  Of course the first thing I did was to go out and search for the solution for this issue but nothing really popped out as ‘this is how to fix this issue’, however a few people did mention that they had to do a VS Repair install.  I thought this to be a bit extreme so I was not too keen to give this a try.

Read More

Embracing UI on demand with the app bar

Embracing UI on demand with the app bar
Creating a great app requires honing in on what makes your app best in its category and making that shine. Windows 8 provides tools like charms and app bars to make it easy to really focus on what makes your app best in class and minimize anything that distracts from it. Learn to use those tools and your app and your users will be able to really enjoy what makes your app great.

Read More

Enforcing square proportions in XAML


Enforcing square proportions in XAML In my current Windows 8 project, I needed an object on the screen to resize with screen size – and keep it’s proportions. Turned out to be a bit trickier than I thought…

What I wanted was this:

I had to have it as Stretch alignment to scale with the screen size, so fixed Width/Height was out of the question. The starting point was to have VerticalAlignment=Stretch to always use a third of the screen height, but what about the Width?

Read More

Styling a GridViewItem in WinRT


Styling a GridViewItem in WinRT

Proving to be the bane of many a burgeoning Windows 8 developer is how buried and convoluted the GridViewItem template turns out to be. Combine a hard to get to template with brushes that derive from ListViewItem rather than GridViewItem and referenced outside of any visible dictionary and you’ve got a day long (at least) treasure hunt on your hands.

In this post, I’ll provide the Style for a GridViewItem, the necessary brushes (with comments), and a sample implementation.

Read More

Thursday 6 September 2012

Understanding and debugging design time data in Expression Blend


One of my favorite features in Expression Blend is the ability to attach a Visual Studio debugger to Blend. First let’s start by answering the question: why exactly do you want to do that?

Note: If you are familiar with the creation and usage of design time data, feel free to scroll down to the paragraph titled “When design time data fails”.

Creating design time data for your app
When a designer works on an app, he needs to see something to design. For “static” UI such as buttons, backgrounds, etc, the user interface elements are going to show up in Blend just fine. If however the data is fetched dynamically from a service (web, database, etc) or created dynamically, most probably Blend is going to show just an empty element.

The classical way to design at that stage is to run the application, navigate to the screen that is under construction (which can involve delays, need to log in, etc…), to measure what is on the screen (colors, margins, width and height, etc) using various tools, going back to Blend, editing the properties of the elements, running again, etc. Obviously this is not ideal.

Read More

Azure Mobile Services: For Those Who Just Want to Code


If you follow Azure news on the web you might have noticed a new Azure service being offered in preview form called Mobile Services.

In this blog post we’ll be doing a high level overview of what Azure Mobile Services is and what it gives you. In subsequent posts we’ll dive deeper into how to get your hands dirty and actually use the thing.

With this initial preview the Windows 8 app development scenario has been enabled. We’re likely to see other platforms such as iOS and Windows Phone (my personal favorite) come on board as the Azure mobile team develops the new service.

Read More

Running a Storyboard as a Task in C#/XAML Windows 8 Metro App


Sometimes you have some code that needs to run after a storyboard has completed. In my case I'm working on a little board game, and after each move (which I animate using a Storyboard), I need to figure out the next move, and either start a new play-animation or pass the turn to the other player.

Therefore I run in a loop until the turn is over. You can detect when a storyboard has finished when the "Completed" event triggers, but that makes for some recursive spaghetti code. It's much easier if I could just "await" the storyboard using a task. So I created the little extension method below that makes this possible.

Read More

Using WinJS & WinRT to build a fun HTML5 Camera Application for Windows 8 (1/4)


Using WinJS & WinRT to build a fun HTML5 Camera Application for Windows 8 (1/4)
Using HTML5, JavaScript & CSS3, we’re going to build a fun HTML5 camera application for Windows 8 and its Modern UI. You will learn how to use WinRT to access to the camera and the file system to take some pictures & videos. We will then work a bit on the layout with CSS3 grid & flexbox and provide some visual feedback to the user via CSS3 animations. I will also show you how to use WinJS and its FlipView control via a templating rendering JS function to embed the whole experience. At last, we will see how to manipulate the images taken with the camera to apply some filters effects via the canvas element or directly thanks to a C++ WinRT component.

Read More

Wednesday 5 September 2012

Fixing the VisualState of your Win8 AppBar ToggleButton


Fixing the VisualState of your Win8 AppBar ToggleButton
This post would also be called Fixing the AppBarButtonStyle for ToggleButton support in you Win8 app: Part 2

In my last post I explained how to fix the AppBarButtonStyle to support ToggleButtons. This minor fix does give you the correct style, however there are more problems. I’m not sure if it is a problem with the style, or with the ToggleButton, but after checking and unchecking the button, the state becomes completely messed up.

Read More

Telerik Pie Chart: Taking Control of the Label


Telerik Pie Chart: Taking Control of the Label
It is pretty straight-forward to create a pie chart with a simple label that identifies the “category” for each slice.  What is a bit trickier is to modify that label so that it shows not only the category, but the percentage each slice represents.

Let’s build the pie chart both ways to see the difference.

In either case, we begin with data.  Our pie chart will reflect a municipal budget, and so our first class is BudgetData.

Read More

Preventing unauthorized modifications of XAML files in Windows 8 apps with XamlIntegRT


Preventing unauthorized modifications of XAML files in Windows 8 apps with XamlIntegRT

An approach for XAML files protection is implemented in XAMLIntegRT library. It is based on comparison of hash codes generated design-time for XAML pages with hashes calculated for pages installed on the target system. XAMLIntegRT includes two components – command line hash code generator and C# library for run-time validation.

XAMLIntegRT Library @ GitHub
XamlIntegRTGen.exe from GitHub
Read More

Automating the testing of Windows 8 apps


Automating the testing of Windows 8 apps

In the blog post for testing Windows Store apps, we’ve primarily covered what to test your apps for. While you can manually execute the verification areas we’ve discussed in the previous post, it is more efficient to automate some of these verification areas. Automating the verification of your app has many benefits. Automated testing saves time and money that you’d otherwise spend doing manual testing. Once created, automated tests can be run over and over again at minimal cost and are much faster than manual tests. This helps ensure that the quality of your app stays high and the cost stays low with every new release of the app. Automated testing also improves the accuracy of the verification because even the most conscientious tester might make mistakes during tedious manual testing.

In this post, we provide some tips and techniques on automating the testing of Windows 8 apps. Keep in mind that automated testing is a powerful technique and it requires some initial investment to reap the full rewards. The advice and examples in this post are meant to get you started, but you’ll need to build and maintain your own infrastructure on top of them. If you are looking for some lighter weight testing techniques, check out the recent blog on testing apps with Visual Studio.

Read More

Windows 8 Apps With HTML5


If you're an experienced Web developer, you'll love the HTML5/JavaScript/CSS3 options provided by Visual Studio 2012. Here's a step-by-step guide to getting started.

We now know that Windows 8 is coming on Oct. 26. That presents developers with a decision to make for building new Metro-style applications: HTML5 with JavaScript and CSS3, or XAML with C#, or Visual Basic with C++?

Many Web developers will choose HTML5/JavaScript/CSS3 because they already have experience with it. Once that decision's made, the next step is to understand Windows Runtime (WinRT) and how its new APIs interact with Windows 8. [As this issue went to press, Microsoft was considering changing the name "Metro" to something else, but hadn't yet decided on the new name. We're leaving it as "Metro" until a new name is officially chosen. -- Ed.]

This article takes you through the process of building your first HTML5/JavaScript/CSS3 Metro application. Let's get started.

Read More @ Visual Studio Magazine

Tuesday 4 September 2012

MSDN Webcast Series - Building Windows 8 Metro Style Apps

MSDN Webcast Series - Building Windows 8 Metro Style Apps

Catch this on-demand MSDN webcast series to learn about the new platform for building Windows 8 Metro style applications. Get an understanding of the platform design tenets, the programming language choices, and the integration points with the operating system and across Metro style apps.

  • Designing apps with Metro style principles and the Windows personality
  • Building Metro style apps with XAML: What .NET developers need to know
  • What HTML developers need to know about coding Windows 8 Metro style apps
  • Win as One: How Contracts in Windows 8 Help You Build a Killer Metro App
  • Bring Your Windows 8 Metro Style Apps to Life with Tiles and Notifications
  • Introduction to the Windows 8 platform and the Windows store
  • Building Windows 8 Metro style casual games using HTML 5

Read More @ channel9

Using vector data for AppBar icons in XAML


Using vector data for AppBar icons in XAML
I was helping a friend today doing some over-the-shoulder code review and suggestions for his Windows app he’s writing for the store.  In doing this I asked a question about how to perform a certain action.  He indicated that he put those functions in the AppBar and was it not obvious I was supposed to use them.  I looked at the AppBar again and found out why I wasn’t drawn to them.  First, the labels he used weren’t descriptive to me and relied too much on me looking at the actual icon.  Second, however, is that when I hovered over them I received no visual feedback I was expecting and immediately thought they were just disabled (the color was slightly gray as well which probably didn’t help this).

I mentioned these to him and noted he should use the AppBarButtonStyle base definition that comes in the Visual Studio templates as a guide and just set the appropriate content.  He proceeded to let me know that he received the vector data from Syncfusion’s Metro Studio product.  We then began to examine the vector data.  Metro Studio is doing probably too much than it needs to for AppBar button definitions.  To be fair, it serves a goal to get Windows UI style icons for the developers in XAML form.  This is great!  However, if my intention is to use them for AppBar buttons, then it is doing too much.  It led me down a path to see how easy it was to use vector data with the default AppBarButtonStyle definition.  Turns out it wasn’t as simple as I thought.  Let me first explain the core issue then walk through a step on how to do this with vector data.

Read More

Namespaces and classes in WinJS


This post is a detour from a larger MVC on WinJS post, but code organization is an important topic for developers transitioning from C#/XAML and merits a blog post of its own.

First, a shameless self-promotion update – I will be speaking in 3 weeks at the NYC Code Camp on the topic of getting started with WinJS programming. You can find the details of the conference here.

I will also be speaking at the MCT Summit on October 26, delivering a talk on advanced WinJS programming and integrating with the cloud. Details of this conference can be found here.
Now we can get to the meat of the matter. WinJS introduces two big tools that are helpful to us and somewhat familiar from the C# world: namespaces/class definitions and the module pattern.

Read More

Adventures in Windows 8: Placing items in a GridView with a ColumnSpan or RowSpan


Adventures in Windows 8: Placing items in a GridView with a ColumnSpan or RowSpan
When working with a GridView, it is quite common to use a VariableSizedWrapGrid as the ItemsPanel. This creates a nice flowing layout which will auto-adapt for various resolutions.

Using ColumnSpan and RowSpan

When you use a VariableSizedWrapGrid directly in your XAML, you can attach the VariableSizedWrapGrid.ColumnSpan and VariableSizedWrapGrid.RowSpan attached properties directly to an item to create the desired effect. For instance this code create this output (shown in Blend but it runs just the same):

Read More

Variable-sized grid items in Windows 8 apps


Variable-sized grid items in Windows 8 apps Wouldn’t it be great if you would be able to control the size of each particular item in your grid? To break out from dullness of having all items the same size, like, for example, to emphasize featured items; or for just any other reason?

Turns out you can do that (quite easily). I came about to this blog post describing one way to do it: “Windows 8 Beauty Tip: Using a VariableSizedWrapGrid in a GridView makes Grids Prettier” by Jerry Nixon. Reading it, I thought there had to be some easier way to do it than subclassing a GridView just for this.

And it turned out there was. Or at least it would be, if Windows 8 XAML supported Style Bindings like Silverlight 5. Not having that, the solution required that extra step that would allow binding to properties from within declared styles.

Read More

Using the Microsoft Ad SDK in Windows 8


Using the Microsoft Ad SDK in Windows 8  One of the best ways to make money with Windows 8 is to display ads in your Windows Store app using the Microsoft Advertising SDK.  Here’s how you can get started.

Prerequisites: You’ll need Windows 8 RTM and Visual Studio 2012.  A free 90 day evaluation edition of Windows 8 Enterprise is available, and VS2012 Express Edition is completely free.

Start by downloading and installing the Microsoft Advertising SDK.  At the time this post is being written, Windows 8 RTM has been released, but the Microsoft Ad SDK is still in beta at version 6.1.0813.1.  It works with Windows 8 RTM, but not all features are supported yet.  The RTM version of the Microsoft Ad SDK is expected in mid-September.

Read More

Monday 3 September 2012

How to Use iFrames in WinRT Apps


How to Use iFrames in WinRT Apps Did you know you could use iframes in WinRT apps developed using JavaScript?  Is this suppose to be exciting?  Why would you care?  For the answers, follow along as I take a journey of discovery attempting to add live Twitter feeds to my app.

To set the stage for what I want to do, you must first understand what a Twitter Widget is.  The folks at Twitter have made it real easy for web developers to create a custom, dynamic section of a web site to display tweets based on a user, a search, favorites, or a list.  Once I know my tweet criteria, I can customize the appearance, dimensions, and other relevant options.  When I am done with all my customizations, I can grab the code that will make the magic happen on my web site.  Um… but I want this in my WinRT app.  Will it work?  Lets find out.

Read More...

Using Shared WinRT C++ Physics Engines in Your WinJS game


Currently there are no Physics Engines that will drop into WinRT and work, but bear in mind that WInRT is used when you need language projection.  That is: You write the code in C++/CX and consume in JavaScript or C# or VB or even C++.  Or C# and consume in the other languages, VB is the same, but JavaScript can only consume.

With respect to existing game libraries like UDK or Autodesk ScaleForm, these C++ libraries can be used with a little more work then I wanted to do, consumed through WinRT and then projected into JavaScript.

Now, it is likely once I post this blog, there will suddenly be 10 or 15 Physics Engines modified to work with WinRT, but for now, there aren’t any that have easily discovered documentation.

Read More...

Transhipment - A WinRT library for structured data sharing

WinRT library for structured data sharing (via Share Contract) using Schema.org data formats.

How To Install Via NuGet

PM> Install-Package Transhipment
Usage In C#


void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
    var request = args.Request;

    var geo = SchemaFactory.Create(Schema.GeoCoordinates) as IGeoCoordinates;
    geo.Name = "Polar Bear Provincial Park";
    geo.Latitude = "54.596931";
    geo.Longitude = "-83.283978";

    request.Data.Properties.Title = "Sample data";
    request.Data.Properties.Description = "data for " + geo.Type;
    request.Data.SetStructuredData(geo);
}

Check it in GitHub
Web Informer Button