måndag 26 januari 2009

Surface SDK's WPF layer

To quickly get around with developing for Microsoft Surface, and understanding how cool multi-touch applications are, the WPF layer is a good starting point. The WPF layer API of the Surface SDK extends Windows Presentation Foundation to be used in touch-enabled user interfaces. WPF layer controls are standard WPF controls, but Microsoft Surface enabled.

The WPF layer is actually really easy to get started with. XAML is used to declaratively define the user interface. Also, many of the controls one is familiar with from WPF also exist for Microsoft Surface, only now prefixed by ‘Surface’. The XAML examples below show two versions of a window with the same functionality, one traditional WPF and the other is Surface.

Standard WPF:


Surface SDK:


Note: Normally ‘Click’ is not a contact event, but for SurfaceButton it is. This is worth keeping in mind for later when you start using ContactDown for other controls.

As you can see there is not much that differs the two windows. This makes it very easy to transition to Microsoft Surface development and rapidly create touch-enabled applications. Use these mnemonic rules to get started:
  • A Surface control is usually named the same thing as you’re used to from WPF, but prefixed with ‘Surface’.
  • To add a handler for use interactions, the mouse events are now called contact events.

fredag 23 januari 2009

Contact: The act or state of touching

While being in contact with the Surface you handle more information than when just placing your finger on a traditional touch-enabled screen. A Contact in ‘Microsoft Surface language’ is the kind of object that touches your Surface screen. The Surface SDK gives you the possibility to recognize different kinds of objects. The ones you can use are Finger, Tagged object or Blob.
  • Finger is self-explanatory; your finger in touch with the touch-enabled screen.
  • Tagged object are objects with an identity tag placed on them. This makes it possible to interpret exactly which object is being placed on the surface table.
  • Blob is an arbitrary object placed on the screen. You might have seen the demo with a wine glass with a surrounding aura – voila a blob.
Ok, so what to do with contacts. The touch-enabled controls for Surface can handle events from user interactions – that is different states of the contacts on the screen. These interactions are called gestures or manipulations.

Gestures are user activity which doesn’t work differently on whatever element is affected. A tapping or pressing action is a tap or push whether it’s a button or custom user control. Manipulations on the other hand are interactions that depend on what control is being touched and how. A manipulation user action has a context. That means that for one control a twirling motion means to rotate the control, but for another the same user interaction means to twist the control’s content.

Using the WPF layer of the Surface SDK the Surface controls are enabled to capture the following events:
  • ContactDown
  • ContactUp
  • ContactTapGesture
  • ContactHoldGesture
  • ContactEnter
  • ContactLeave
  • ContactChanged
More about the mentioned contact events when we come back to the WPF layer in a coming blog posts.

lördag 17 januari 2009

Ordering a Surface Table

So how do you do when you want to order a Surface table? The first thing you need to do is to contact your local Microsoft representative. From her/him you will get an order form that you are supposed to send to an email address. After that there is nothing. I didn’t get any reply, no confirmation and no nothing. So I waited for a couple of days and then I contacted the local Microsoft representative again and he contacted the Surface Business Desk and managed to get a delivery date! Or at least a date when our unit will leave the warehouse in Germany. So on the 29th of January it will leave Germany so in the beginning of February it will arrive to Stockholm. I can’t wait!

In the reply from the Surface Business Desk they also said that the team working with the shipments is working fast and furiously to ramp up and ship units to customers. It would be really interesting to know how many units that are ordered in Sweden and in the rest of Europe.

I’m still waiting to get the exact shipping details and logistics so that I soon can get my hand on our big ass table!

Surface simulator


When developing applications for the Microsoft Surface you have a Surface Simulator that gets installed when you install the SDK. This can be used to simulate user input and contact with objects that are placed on the Surface-unit.

So far I have only tried the sample applications that are installed with the SDK and done some simple applications that don’t use any object recognition. But the simulator seems to work fine so far.

There are differens buttons button in the simulator that is used to simulate a finger or an object place on the Surface. To simulate the use of two fingers you can hold the left mouse button and then click on the right mouse button to place the finger. It is also possible to plug in two usb-mice to simulate two fingers or two objects.

Today I noticed a really cool feature. If you use a finger or object representation in the simulator and then scroll on the scroll wheel on the mouse the finger or object is rotated. This will come really handy when you use the simulator to display some sort of graphics around a placed object.

Just remember to start the simulator before starting the application from Visual Studio. Otherwise you will not get access to these features and your application will start in some other mode that I so far don’t know what it’s used for.

onsdag 14 januari 2009

Answer from the Surface team

I also got an answer from Robert Levy on the Surface team. He said that they don´t have a workaround for this right now but are looking closely at allowing installation of the SDK on Win7 for our next release. There was no word about when this releas is expected.

Surface on Windows 7 - Now it works!

I had actually given up all hopes to be able to install the Surface SDK on Windows 7. Yesterday I tried to consult two of the sharpest wiz-kids at Connecta and made some progress but after a while it was a dead end. I actually had thrown in the towel and decided to go for a dual boot. So I started the disk manager and shrunk the disk to create a new partition with 20 GB to host Windows Vista. Installed Vista on the new partition and then it was too late in the evening to continue.

And then, this night, at 00:25 there was a reply from Kurt Brockett at Blendables.com on a post that I made to their forum!

As I already had assumed the only problem with the failed installation is the OS-check at the beginning. A colleague of mine tried to install the SDK on Windows XP and found out that there is a property missing on advapi32.dll that is one of the core dll’s in Windows. This property is of course present in the Vista version and I assume that it’s also there in the Windows 7 version. So if there was only a way to get around the OS-check…

What Kurt told me in the post was that there is a way to edit msi-packages with a simple vb-script!

So to be able to install the Surface SDK on Windows 7 just download the script and place it in the same directory as SurfaceSDKWE.msi. Then drag the msi-file and drop it on the removechk.vbs. This will remove the OS-check and the installation of the SDK will work perfectly!

Now I have started the Surface Simulator and tried the samples and everything works great on Windows 7! Love it!

The thread on Blendables.
Link to the vbs-file to remove the check.

måndag 12 januari 2009

Surface on Windows 7

Today I decided to install Windows 7 on my developer machine. First I tried an upgrade but it was unsuccessful since I only had the Enterprise version of Vista and beta 1 of Windows 7 is Ultimate. So instead I tried a clean install and that was really smooth. I started the installation directly from a mounted image in Vista and it was finished after 30 or maybe 45 minutes. No drivers or other installations messing things up. The only thing that didn’t work – so far – was Daemon Tools. Instead I downloaded PowerISO and that worked perfectly. So far I haven’t had any limitations with the unregistered version.

F-Secure Antivirus, Office 2007 and Visual Studio 2008 was also easy but when it came to the Surface SDK I got some problems. The XNA Redistributable was no problem but right at the beginning of the installation of Microsoft Surface SDK 1.0, Workstation Edition I get an error telling me that I’ve got the wrong Service Pack version for Vista installed. The software requirements say that I have to use Vista Business, Enterprise or Ultimate with Service Pack 1. So I’m stuck!

I have sent an email to one of the guys on the Surface Team at Microsoft and a post in the NUI Groups forum hoping for the best.

torsdag 8 januari 2009

I'm a Surface Developer, yes I am!

This blog, Surface Developer, is about developing for the Microsoft Surface.

The company that I work for, Connecta AB, finally agreed to let me order a Surface table yesterday. So now we have assigned a Scrum Master, formed a Scrum team, set one person responsible for the business parts and myself as responsible for the technical aspects. I will also be part of the Scrum team as a developer.

Hopefully I will get someone else from the team to contribute to this blog but I will wait with any deeper presentation of the team members until then.

I myself also run a blog in Swedish at http://bjorneriksen.blogspot.com but my feeling is that this might attract an international horde of readers so I assume that English is a more suitable language.

Hopefully we will be able to post videos, pictures and stuff about the applications that we develop.

Right now I'm waiting for a comfirmation of my order and a planned delivery date and it is also time to start planning a kick off!