Preface
The personal computer (PC), which first hit the market over 30 years ago, has undergone tectonic changes that, in turn, launched the PC era. PCs were primarily used in the workplace where software was simple and optimized for use with the keyboard; touching a screen was unheard of until recently. Slowly computers began creeping into the home and many users didnt know what to do with them; they were glorified typewriters.
When PCs started connecting to the Internet, possibilities reached a new level, which had a snowball effect. It allowed academia to share research; it spawned new means of communication from email and online chat to social networking, captivating the minds of people young and old. Soon consumers started using laptops and unplugging from the conventional desktop setting.
This shift had little impact on applications, but helped define a new wave of form factors in phones, tablets, and slates. Eventually, users started demanding more and we ushered in a new era, the modern consumer era. We are all modern consumers, not only consumers of goods, but consumers of information. We are constantly connected through the use of mobile devices as well as more traditional computers. Whatever type of device, be it static or mobile, content is synchronized and up-to-date. These new devices are used as gaming machines and personal entertainment centers, and they are replacing books and magazines for many avid readers.
Today, consumers expect developers to create apps where touch, mobility, and good battery life are a must. Tablets and slates leverage touch as a primary form of interaction while playing a critical role in the adoption of sensors and cameras in everyday computing. They are small and lightweight, making them extremely portable. Devices boot almost instantly so users can get to their content and put them right back in their bag without missing a step. Despite their youth, these devices are being embraced by work forces and consumers worldwide and they appear to be on a relentless progression.
With all this excitement, its hard to believe weve only begun to scratch the surface. We need a platform built from the ground up with these objectives in mind. This next version of Windows, code-named Windows 8, ships with a new application model for building user experiences tailored to the next generation of devices.
The Windows Runtime
The underpinning for that new user experience is the Windows Runtime. For years Windows desktop applications interacted with the Win32APIs in some fashion, whether they were opening file dialogs, rendering graphics, or communicating over the network. Instead of replacing this, Windows 8 continues its support for the Win32APIs allowing existing Windows 7 apps to run seamlessly. What they built instead is a brand new API from the ground up called the Windows Runtime (WinRT). WinRT consists of an application execution environment and a collection of new APIs, which enables a new line of immersive full screen apps called Metro style apps.
Windows desktop applications are still available and continue to be relevant for many situations. In fact, desktop applications can leverage the power of the Windows Runtime APIfor example communicating with sensors.
Metro style apps are designed to communicate with WinRT via a language-independent projection layer, which enables apps to be written in statically-typed languages like C++, C#, and Visual Basic, while also feeling natural to dynamic languages like JavaScript. WinRT introduces a new trust model for users, called base trust. Unlike full trust, this model isolates each application while funneling high-level action through the runtime broker to ensure users are aware when apps attempt to access protected resources. Even though Metro style apps promote a model where the user is in charge, you will find their ability to connect with other apps is far superior than its predecessor. Metro style apps can communicate with other apps using generic contracts and send or receive content in various formatslike text and photos. Contracts can also be defined to access core operating system components, like Search, to highlight your app even though it may seem irrelevant. (Well discuss contracts and search later in .)
Note
Once a revolutionary technology, like mobile computing, has been unleashed its hard not to push its potential. You can already see signs that manufacturers and researchers are innovating well beyond what is on the streets today. Microsoft is committed to contributing to the future of technology in a big way and Windows 8 is just the start. For more insight and the impending possibilities into whats next for Microsoft, a video of their vision for the future can be found online at http://www.youtube.com/playlist?list=PL2B8C6AB94E8259C6.
Disclaimer
Windows 8 is currently in Release Preview; as such, some of the content in this book may change.
Who This Book Is For
This book is written for existing .NET developers who are interested in the changes introduced with the release of Windows 8.
This book is intended to be a guide to developing complete Metro style apps. If you have an idea or you are just curious about the platform, this is the place to start. For a reference on all things related to Windows 8 development I recommend the Windows Dev Center at http://dev.windows.com and the Windows Dev Forum at http://forums.dev.windows.com.
The samples in this book are in C# and XAML. All of the samples in this book are available for download on this books website at http://bendewey.com/getting-started-with-metro-apps and at https://github.com/bendewey/GettingStartedWithMetroApps.
How This Book Is Organized
This book focuses on helping you become familiar with the new Windows 8 landscape, WinRT, and writing your first Metro style apps, from creating a simple search app to writing a touch enabled app that responds to native sensors. This book will go through the steps taken to create a full application using the Bing Search API and publishing it to the Windows Store. It has been broken up into five chapters:
This chapter focuses on a high-level overview of the Windows 8 features that power Metro style apps. From the new OS features, like the new Start Screen, to the in app features such as the Application Bar. Many of these features will be covered in depth in later chapters.
Before building the full Bing Image Search application I will walk you through creating a simple version of the application that communicates with the Bing Search API and binds the results to a simple UI. If you choose to follow along you will need to obtain an account key for the Bing Search API service on the Azure Marketplace.
Once youve seen how to create a simple application using the Bing Search API, Ill show you what it takes to complete an application that leverages the full power of the Windows 8 platform. Chapter 3 will also focus on the goals, techniques, and designs used throughout the app.
Developers can create impressive apps of all shapes and sizes. At some point you will need to access some external resource. Whether youre communicating with web services or responding to events from one of the many native sensors, this chapter shows you how the Bing Image Search application takes advantage of these various features and how to implement them in a maintainable fashion.