Click here to Skip to main content
Click here to Skip to main content

From Soup to Nuts with the Surface SDK 2.0

, 31 Jul 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
A look at the new Surface SDK 2.0 that was recently released by Microsoft
image001.png

Introduction

With the Microsoft® Surface® 2.0 SDK, you can easily create applications to take advantage of the next generation Surface computing device or any Windows touch-enables devices (defined by Microsoft).

Links worth checking out (thanks to Luis Cabrera):

Getting the SDK Installed

After downloading the Surface 2 SDK, double click the installer on the SDK to get the ball rolling.

Getting the Runtime Installed

Once that is complete, then double click the installer for the Surface 2.0 Runtime.

A Few Things to Note After Installing It

Hit your Start button and go to your programs and navigate to the Microsoft Surface 2.0 SDK. You will notice the normal “Getting Help” and “Release Notes”, but it also contains Surface Samples and Tools.

Surface Samples

After clicking on that folder, you will see a Surface Code Samples.zip file.

Go ahead and extract the zip file and you will notice the following sample project exists.

Once loaded into Visual Studio 2010, you will see 14 projects exist inside of the solution.

Go ahead and set one of them as your “Startup Project”.

You can now use your mouse or a touch-enabled monitor to interact with the application. You also have the full source code, so you can manipulate the application all you want.

They have several other great examples of what the Surface 2.0 SDK is capable of.

The Tools Folder

Inside the tools folder, you will find the following applications:

Input Simulator - Simulate touch input and supported hardware parameters.

According to the docs (updated now for version 2.0):

Surface Simulator replicates the user interface and behavior of a Microsoft Surface unit that is in user mode. Surface Simulator has access points, Launcher, and the loading screen. When you start an application in Surface Simulator, the application displays like it is on a Microsoft Surface unit.

You can use Surface Simulator to evaluate how an application and its user interface respond to basic input. For example, if you simulate a painting application and if you touch multiple colors, one at a time, and then add the colors to a mixing bucket, you can test the logic of the application and how well it mixes the colors by using the touch-based interface.

Surface Simulator runs with the appearance and functionality of a Microsoft Surface unit in user mode (the way that it appears to users). You can switch applications by using Launcher and the access points that display on the Launcher screen and the applications.

Input Visualizer - Display input data on top of a Microsoft Surface application.

According to the docs:

The Input Visualizer tool enables you to see the contact data that the Microsoft Surface Vision System returns in the context of your application. This tool runs on top of your application and displays information about the contacts that the input system detects.

Input Visualizer can help you test and debug the following scenarios:

  • Accidental input: Track the accidental activation of Microsoft Surface controls from palms, forearms, and other objects by seeing when these controls detect contacts.
  • Contact tracking: Determine what gestures are lost as contacts when users are dragging content in Microsoft Surface applications. You can use the fade away feature of Input Visualizer for this type of tracking.
  • Input hit-testing: Investigate where hit-testing occurs by freezing the user interface of Input Visualizer, lifting contacts, and seeing where their centers are reported.

Input Visualizer is installed with the Microsoft Surface SDK and runs only on Microsoft Surface units. If you are developing on a separate workstation, Surface Simulator provides contact visuals, reducing how much you need a visual representation of input.

Surface Stress - Open a command prompt window to run stress tests against a Microsoft Surface application.

According to the docs:

The Surface Stress tool enables you to test the stability and robustness of your Microsoft Surface application by delivering multiple, simultaneous contacts to your application in a random way. Surface Stress generates all four types of contacts: fingers, blobs, byte tags, and identity tags.

Surface Stress is included with Microsoft Surface SDK 1.0 SP1. By default, the Surface Stress executable file (SurfaceStress.exe) is located in the C:\Program Files\Microsoft SDKs\Surface\v1.0\Tools\SurfaceStress folder, and a shortcut to Surface Stress appears in the Start menu under the Microsoft Surface SDK entry.

Let’s create a new project.

Now that you have learned how to download and get started with it, it is time to actually create an application. Go ahead and fire up Visual Studio 2010 and begin a new project. Look for Surface then v2.0.

You will notice that you have 2 templates to start with:

  • Surface Application (WPF)
  • Surface Application (XNA Game Studio 4.0)

We are only going to focus on the Surface Application (WPF).

Go ahead and give your application a name and hit OK.

At first glance, you will realize this is just a WPF application. The folder structure looks just like what we would expect for a WPF application except that you have a “Resources” folder, a .xml document and MainPage.xaml is now called SurfaceWindow1.xaml.

Let’s go ahead and take a look at the Toolbox. What we are most interested in is the “Surface Controls”. As you can see from this long list, there is a lot of Surface specific controls at our disposal right off the bat.

Let’s go ahead and use the “SurfaceInkCanvas”. So drag and drop it onto the SurfaceWindow1.xaml file.

Make sure your XAML looks very similar to the following:

<s:SurfaceWindow x:Class="MichaelSurfaceApplication.SurfaceWindow1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    Title="MichaelSurfaceApplication">
  <Grid>
        <s:SurfaceInkCanvas Name="SampleInkCanvas" 
	HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <s:SurfaceInkCanvas.DefaultDrawingAttributes>
                <DrawingAttributes Color="#FF808080"/>
            </s:SurfaceInkCanvas.DefaultDrawingAttributes>
        </s:SurfaceInkCanvas>
    </Grid>
</s:SurfaceWindow>

Now go ahead and run your application and you should get the following screen. Go ahead and draw something on the screen and then close the window.

Congratulations! You just created your first Surface 2.0 application while actually writing no code. While you are probably testing it on your laptop or desktop, this application would actually run on a Surface 2 Unit! Very cool stuff indeed.

Conclusion

The Surface is very cool technology and I am planning on investing a lot of time into it and other things such as Kinect. Microsoft really got it right with the Surface 2.0 SDK. I think that this is possibly the best SDK release Microsoft has ever been a part of. The documentation is excellent, the samples are a plenty and it’s just plain easy to build your first application. Now if only I had an actual Surface 2 table in my house to play with, then I would be really happy.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mbcrump
Software Developer (Senior) Telerik
United States United States
Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a systems administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson corporation and has been working with some form of .NET and VB/C# since 2003.
 
He has worked at Fortune 500 companies where he gained experience in embedded systems design and software development to systems administration and database programming, and everything in between.
 
His primary focus right now is developing healthcare software solutions using Microsoft .NET technologies. He prefers building infrastructure components, reusable shared libraries and helping companies define, develop and automate process standards and guidelines.
 
You can read his blog at: MichaelCrump.net or follow him on Twitter at @mbcrump.
Follow on   Twitter

Comments and Discussions

 
QuestionWhat's different between win8 with vs2012 and Surface SDK? PinmemberHSU_05041-Jul-13 16:53 
GeneralMy vote of 5 Pinmember@AmitGajjar5-Nov-12 21:44 
GeneralMy vote of 5 PinmemberGPUToaster1-Aug-11 23:45 
GeneralMy vote of 4 PinmemberReiss31-Jul-11 22:58 
GeneralMy vote of 5 Pinmemberkuyexing31-Jul-11 22:46 
QuestionNow you got me excited PinmemberMike Hankey31-Jul-11 19:21 
GeneralMy vote of 5 PinmvpKunal_Chowdhury31-Jul-11 18:47 
GeneralThank you! PinmemberRavi Bhavnani31-Jul-11 17:50 
GeneralRe: Thank you! Pinmembermbcrump31-Jul-11 17:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411019.1 | Last Updated 31 Jul 2011
Article Copyright 2011 by mbcrump
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid