Build Your First Windows 8 App with Microsoft Visual C# and Visual Basic
After completing this chapter, you will be able to
Install and use the Microsoft Visual Studio 2012 tools to develop a Windows 8 app.
Understand and use the Project template.
Create a simple application using C# and Visual Basic (VB).
Test the application.
Use the Windows 8 Runtime (WinRT) APIs from a Windows 8 application.
The preceding chapters showed you how Microsoft Windows 8 provides a new user interface, a completely new user experience, and exposes a new set of application programming interfaces (APIs) called Windows Runtime APIs (WinRT). The new user interface and experience is based around the Windows 8 UI style you just learned about in Chapter 2.
This chapter translates what you saw into practice. You will start by creating a simple Windows 8 app from scratch using one of the templates provided by Visual Studio 2012. Then you will deploy it to the local machine. Finally, you will implement a simple call to some WinRT APIs.
To start developing Windows 8 applications, you need Visual Studio 2012. This new version of Visual Studio can be installed to run side by side with an existing Visual Studio 2010 installation and contains the .NET Framework version 4.5. The .NET Framework 4.5 is not a major release but it does contain some important features that enable the use of WinRT APIs. Even though you can develop applications using other versions of Windows and deploy them to a Windows 8 box or test it in the provided emulator, we suggest you install the development environment directly on a machine with Windows 8. This will speed up the development and testing processes on hardware-related components: for instance, if your apps use the accelerometer, the inclinometer, the camera, or any other sensor, the testing and debugging phase will be more accurate and quicker.
To download Windows 8, go to http://msdn.microsoft.com/windows/apps—the home page for the Windows 8 app development. From this page, it is easy to reach all the downloads for Windows 8. In the Getting Started section, you can find useful information for the download and installation process.
As you saw in Chapter 1, Visual Studio 2012 Express for Windows 8 is a free version of Visual Studio tailored to contain just what you need to develop a Windows 8 app. You can also use the full version of Visual Studio 2012 by installing it on top of the Express edition or you can keep it as a separate installation.
To summarize, the components you need to start developing a Windows 8 app are the following:
Visual Studio 2012 Express edition for Windows 8. On top of this version, you can install a more advanced edition of Visual Studio 2012 (for instance the Ultimate edition).
The Windows 8 SDK. To obtain the templates and the integration with the Windows 8 environment, this component is packaged together with Visual Studio 2012 Express for Windows 8.
Windows 8. You’ll need this to test the application in the real environment.
A developer license. The integrated development environment (IDE) handles this requirement automatically and all you need to do is select Yes when the dialog box pops up.