Taking a look at the Windows Simulator in Visual Studio 11
Join the DZone community and get the full member experience.Join For Free
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.
2) you can also select remote machine and you will be presented with the “ select remote debugger connection ” as shown below:
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.
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:
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
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
tries to duplicate the
of the device.
the emulator tries to duplicate the inner workings of the device.
back to the simulator
if you place a check in simulator and run your application, you will see the following:
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.
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:
let’s start with the fourth item down.
as soon as you select touch emulation and return to the simulator you cursor will look like the following:
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:
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:
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.
both of these settings will allow you to rotate the screen +90/-90 degrees to the left or right.
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.
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.
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 .
Published at DZone with permission of Michael Crump. See the original article here.
Opinions expressed by DZone contributors are their own.