Over a million developers have joined DZone.

Taking a look at the Windows Simulator in Visual Studio 11

·

Introduction

Today, we are going to take a look at the Windows Simulator which ships with Visual Studio 11 and is used to debug Metro Style apps for Windows 8. I think it is important to learn about the features available in the simulator where we can  better understand the way our Metro applications behave. It is also beneficial for those of us without access to a touch-screen monitor.

Before we start, you can check out all of my Windows 8 Articles here.

We have three ways to debug a Metro Application

1) By default, if you run a Visual Studio 11 Metro Application it will run on the local machine.

image

2) You can also select Remote Machine and you will be presented with the “Select Remote Debugger Connection” as shown below:

image

image

This option deserves it own blog post, so for the time being just be aware that it exists.

3) The third and final way is Simulator – Which is what we are going to explore today.

image

Hold up!

What’s the difference between a simulator and a emulator?

Let’s say you want to duplicate the behavior of an old HP calculator, there are two options:

  1. You write new program that draws the calculator's display and keys, and when the user clicks on the keys, your programs does what the old calculator did. This is a Simulator

  2. You get a dump of the calculator's firmware, then write a program that loads the firmware and interprets it the same way the microprocessor in the calculator did. This is an Emulator

The Simulator tries to duplicate the behavior of the device.
The Emulator tries to duplicate the inner workings of the device.

This wonderful explanation was actually taken from Carlos Gutiérrez as he explained it to StackOverflow users.

Back to the Simulator

If you place a check in Simulator and run your application, you will see the following:

image

What is important to note here is that this simulation is actually a Remote Desktop Session into your machine.

Don’t believe me? Hit the Windows Start Button in the Simulator and you will see your desktop. You can browse, execute, and do everything you normally do.

image

The key thing to note here is the Touch Controls located to the right of the screen. Here is a quick reference that I created defining each item:

image

Let’s start with the fourth item down.

Touch Emulation

As soon as you select Touch Emulation and return to the simulator you cursor will look like the following:

image

This mode will simulate the user swiping with a single finger – one contact.

Touch Emulation Pinch/Zoom

As soon as you select Touch Emulation Pinch/Zoom and return to the simulator you cursor will look like the following:

 

image

This mode will simulate the users using multiple fingers to pinch/zoom in – two contacts. If you click the left mouse button and rotate the wheel simultaneously, the Windows Simulator will send touch events to the target application as if the user was performing a Pinch/Zoom gesture on a physical touch device. See the illustration below:

image

Touch Emulation Rotate

This mode will simulate the users using multiple fingers to rotate – two contacts. Looks like the Pinch/Zoom when first selected but when you use the mouse wheel it actually rotates the two contact points relative to each other.

image

Screen Rotation

Both of these settings will allow you to rotate the screen +90/-90 degrees to the left or right.

imageimage

 

image

Change Resolution

This mode will simply allow us to change the resolution inside the simulator to test our apps against different size tablets. You can see the various options available below.

image

Resizing

While this isn’t part of the touch control it is a handy tip.  You can resize the simulator by clicking on the bottom right corner and dragging your mouse cursor as shown below.

image

Wrap-up

As you can see from this post, the simulator is in a great shape starting from Day one. I normally wouldn’t expect this polished of a product until a later release. I believe this shows that Microsoft is committed to giving developers the right tools to build Metro applications. If you have any questions then feel free to contact me. Also, don’t forget to subscribe to my RSS feed and follow me on twitter.

Topics:

Published at DZone with permission of Michael Crump. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}