Join Michael Lehman for an in-depth discussion in this video Debugging using the simulator, part of Visual Studio 2013 for Windows Store Developers.
In the previous video I talked about there being three different ways to debug your Windows Store application using Visual Studio. Those three ways are the simulator, using your native local machine in full resolution, and remote debugging. In this video we're going to talk about using the simulator. So let's go ahead and create a new project. Once again we'll just use the split app template. In the main toolbar here, you can see that we can drop this down and there's three different ways: Simulator, Local Machine or Remote Machine. So we're going to go ahead and pick Simulator.
Now the simulator is a little different in Windows Store app development than you might see either with the Android simulator or iOS simulator, if you're familiar with those, in that it isn't actually running the application in a simulated way. Because it's on a system different than the application can run on. This simulator basically allows you to create a different variety of user input using a mouse, so that you can simulate things like touch input. You can simulate things like rotation, that you can't easily do with your desktop monitor and keyboard and mouse.
The important thing to recognize is the application is actually deployed on your local machine and in the simulator you can run any application that's already deployed on your local machine. So again, it's not really simulating the running environment, it's simulating the input environment only. So we're going to go ahead and build and deploy and fire up our app in the simulator. Now you can see we have this smaller version of the windows UI in this floatable window here. And there's a number of features that are available in the simulator.
You can continue to use it in mouse mode, which is the default. Or you can use it in touch mode. Which you can see the size of the touch circle here as you tap various things in the user interface. Using the mouse, it simulates what happens if the user taps with their finger. There's also a way of doing pinch and zoom. So for example, if I hold down the mouse button, and use the scroll wheel, I can pinch and zoom. I can also select rotation mode, so that if I were holding down two fingers on a actual device and twirling them around, one around the other, it would work that way.
You can also rotate your interface so that you can see if it works properly in portrait mode as well as landscape. You can even check it in upside down mode And you can rotate in both directions. By default, the simulator simulates a 10.6 inch screen in 1366 by 768 pixel resolution. Using this flyout menu here, you can select a variety of other resolutions and sizes. So for example, we could pick the same aspect ratio, 16 by 9 here. But 2560 x 1440, in which case our app essentially looks the same because everything here is being done with WPF.
But if we choose a smaller resolution, you can also see how your app would look on a seven inch screen, or if someone has a large screen. Same thing. You can see how your app would look now. Here's one where the resolution is actually quite a bit bigger, because there's more pixels on the screen. So you can see how it would look on one of those giant 27 inch screens. The kind you've seen people use on Microsoft's channel nine. In addition to changing the resolution, you can also set locations so that when your app asks for the current location. You can specify where it is, and you can take screenshots.
Now this is useful because when you deploy your app to the Windows Store, you have to take screenshots. And if you want to have screenshots in different resolutions, and you don't have all those devices, you can use the simulator to do that. Finally, you can specify what your screenshot settings are. Whether you want to save it to a file, whether you want to see previously saved screenshots, and whether you want to choose to save your screenshots, in a specific location. That's often handy when you're building up your assets for uploading an app to the Windows Phone Store, and we'll see some of that here in chapter four.
So we'll take screenshots and we'll save them in particular file so that when we have to get them in order to be able to upload them to the Windows Store website, we know where they are. Finally, you can specify different network properties. This allows you to simulate 3G networks, whether the network cost is fixed or is unrestricted. Whether there's a data limit, whether there's roaming. So that your app can check for these various features. And implement functionality when the user is in less restrictive non-roaming modes versus when they're in restrictive and roaming modes.
For example you might not automatically download pictures if the user is in a data-regulated roaming situation. Where if you're connected to Wi-Fi, and so you're unrestricted and high-speed, you actually automatically download more content for them. So that's the experience of developing and deploying an app on the Windows Store simulator. You even have a Windows home button here, so that you can fire up any other app that you want. For example you can fire up the weather app. So you can swipe in from the side and do app switching and all the things you could do, if you actually had, a touch device.
Next up, let's take a look at local machine debugging.
- What's new in Visual Studio 2013?
- Exploring the editor
- Invoking the compiler
- Using the debugger
- Creating apps for Windows Store
- Debugging a Windows Store app using a simulator
- Creating an account and connecting to the Windows Store
- Packaging the app