Preface

The first whispers about windows 8 surfaced in early 2011. Widespread speculation swept the Internet as developers began to question what the new platform would look like. The rumors included a new platform that wouldn’t support the .NET Framework, was based solely on C++ or HTML5 and JavaScript, and wouldn’t run any existing software. Early builds and screenshots leaked over Twitter but this only fueled speculation. Finally Steven Sinofsky, President of the Windows Division at Microsoft, took the stage on September 13, 2011 and released an early build of Windows 8 to the world.

I was one of the first eager programmers to download the early build, and I installed it in a virtual machine. It didn’t take long for me to realize that the .NET Framework was alive and well, I could run my existing Silverlight applications on the new platform, and C# and XAML were tools available to build the new “Metro-style” applications (this name was changed to Windows Store applications with the RTM version of Windows). I didn’t make it to the //BUILD conference hosted in California to release Windows 8, but the sessions were made available almost immediately after they were presented, and I watched them every evening, morning, or while I was traveling by plane.

The Windows 8 platform features the Windows Runtime, a new framework for building applications that provides capabilities never before available on a Windows machine. I was building applications within days and was delighted to find that my existing C# and XAML skills from Silverlight and Windows Presentation Foundation (WPF) applied to the runtime, while a new set of components made it easier than ever to developer rich, touch-based applications. It wasn’t long before I reached out to the publisher of my book, Designing Silverlight Business Applications, and said, “I want to write my next book on Windows 8.”

I was fortunate to get involved in an early adoption program with Microsoft. The consulting and training firm I work for, Wintellect, was hired to provide some hands-on labs and workshops specifically targeted to new developers who want to learn how to build applications for Windows 8. This gave me critical access to early builds of the product and enabled me to start writing about the various features that would ultimately become part of the final release. As I built samples that covered manipulating objects on screen with touch, sharing rich content between applications, and providing live interactive tiles on the start menu with at-a-glance content, my excitement quickly grew.

As part of writing this book, I wrote an article that shares what I believe are the top 10 reasons developers will love building Windows 8 applications. You can read the full article online at:

http://www.informit.com/articles/article.aspx?p=1853667

In summary, these are the reasons I think you will enjoy the new platform:

Programming language support—It is possible to write Windows 8 applications with VB, C#, C++, and XAML, or a special stack that includes HTML5 and JavaScript.

XAML—Developers familiar with the power and flexibility of XAML who have written Silverlight and/or WPF applications in the past will be very comfortable with the XAML used to develop Windows 8 applications.

HTML5—The rich support for HTML5 as a markup option will appeal to web developers crossing over to tablet and touch-based development, although this book will deal primarily with the C# and XAML option.

Windows Runtime (WinRT)—The Windows Runtime provides a number of controls, components, classes, and method calls that make performing complex tasks both consistent and easy using just a few lines of code.

Contracts—The new system of “Contracts” enables a new level of sharing and integration between applications and the end user.

Asynchronous support—The introduction of the await and async keywords makes programming multi-threaded code more straightforward than it has even been.

Touch—Touch-based input is first-class in Windows 8 applications with out-of-the-box support from all of the available controls and a straightforward API to interface with touch events and manipulations.

Settings—The settings experience (provided via a Contract) provides a very consistent and familiar way for developers to allow end users to configure their application preferences.

Roaming profiles—Building code that synchronizes across Windows 8 machines through the cloud is simple and easy. (You can literally share a data file with a single line of code.)

Icons—Windows 8 features a rich set of pre-existing icons that you can use to provide consistent interfaces for commands within your applications.

To avoid confusion, I refer to the special new programs built specifically for Windows 8 as “Windows 8 applications” throughout this book. The templates to create these new applications in Visual Studio 2012 are grouped under the name “Windows Store.” Although these applications can be distributed through the Windows Store, you can also distribute traditional desktop-style applications through the store. Therefore, I will only use “Windows Store” when I refer to the Visual Studio 2012 templates, or when I compare the newer style of application to the traditional desktop style. Everywhere else, you will see them referred to as “Windows 8 applications.”

The top 10 items just scratch the surface of the new platform. Windows 8 is definitely different than previous releases of Windows and does require change. You will need to adopt a new interface that elevates touch to a first-class citizen but always provides ways to navigate using the mouse and keyboard. You will have to get used to code that calls native unmanaged components in a way that is almost transparent, and deal with a new set of controls and components that previously did not exist. This book is intended to guide you through the process of learning the new territory quickly so you can begin building amazing new applications using skills you already have with C# and XAML.

What This Book Is About

The purpose of this book is to explain how to write Windows 8 applications using the C# programming language, Extensible Application Markup Language (XAML), the Windows Runtime, and the .NET Framework. For this book, I assume you have some development experience. While I do cover basic topics related to C# and XAML, I try to focus on the areas specific to building Windows 8 applications. Where I introduce more advanced concepts specific to C# or XAML that are not specific to the Windows 8 platform, I reference other books, articles, or online resources so you can further explore those fundamentals.

Whether you’re an existing Silverlight of WPF developer looking to migrate an existing application, or a developer who is transitioning the Windows 8 platform for the first time, this book will give you the guidance and resources to quickly learn what you need to go from a new project to a published application in the application store.

How to Use This Book

The goal of this book is to enable you to write Windows 8 applications with C# and XAML. Each chapter is designed to help you move from a fundamental understanding of the target platform to building your first application. Code examples are provided that demonstrate the features and best practices for programming them. Most chapters build on previous content to provide a continuous narrative that walks through all of the components that make up a typical Windows 8 application.

Each chapter is similarly structured. The chapters begin with an introduction to a topic and an inventory of the capabilities that topic provides. This is followed by code samples and walk-throughs to demonstrate the application of the topics. The code samples are explained in detail and the topic is summarized to highlight the specific information that is most important for you to consider.

I suggest you read the book from start to finish, regardless of your existing situation. You will find that your understanding grows as you read each chapter and concepts are introduced, reinforced, and tied together. After you’ve read the book in its entirety, you will then be able to keep it as a reference guide and refer to specific chapters any time you require clarification about a particular topic.

My Experience with the Microsoft Stack

My first computer program was written in BASIC on a TI-99/4A. From there I programmed assembly language for the Commodore 64, learned C and C++ on Unix-based systems, and later wrote supply chain management software on the midrange AS/400 computer (now known as iSeries). For the past 20 years, my primary focus has been developing scalable, highly concurrent web-based enterprise applications.

I started my work with Silverlight right before the 3.0 release. At the time, I led a team of 12 developers working on an ASP .NET mobile device management platform that relied heavily on AJAX to provide a desktop-like user experience. When it was evident that the team was spending more time learning various web technologies such as CSS and JavaScript and testing the application on multiple browsers and platforms than focusing on core business value, I began researching alternative solutions and determined that Silverlight was the key our team was looking for.

Since that transition, I worked on XAML applications in the enterprise along with large-scale web applications built with the ASP.NET MVC framework. In addition to the mobile device management software, I helped build the health monitoring system for the back-end data centers that provided video streams (live and on demand) during the 2010 Vancouver Winter Olympics. I worked on a major social media analytics project that used Silverlight to present data that was mined from social networks and analyzed to provide brand sentiment. I worked with a team that built a slate-based sales interface for field agents to close sales and integrate with their point of sale system. I was on the team that produced the Silverlight version of a major eBook reading platform designed for accessibility and customized to provide interactive experiences and audio for children.

All of this work has been with the company Wintellect, founded by well-known .NET luminaries Jeffrey Richter, Jeff Prosise, and John Robbins. All three have produced countless books about the Microsoft stack, .NET Framework, and Core Language Runtime (CLR). They have trained thousands of Microsoft employees (some teams at Microsoft are required to take their courses as a prerequisite to working on their projects) and contributed to the runtime itself by writing and designing portions of the framework. The company has provided me with unique access to industry leaders and architects and their best practices and solutions for creating successful enterprise applications.

I am certified in various XAML technologies, including Microsoft Silverlight developer (MCTS) and WPF Developer (MCP). I was recognized as a Microsoft Most Valuable Professional® (MVP) for Silverlight in July of 2010 and was re-awarded the title in 2011 and 2012. This was due mostly to my efforts to blog, tweet, and speak about XAML technologies at various user group meetings and conferences around the country. I have conducted hands-on labs and training for Windows 8, worked on its earliest builds, and continue to blog and write about the platform as it develops. It is my depth of experience working with XAML and understanding how to build server and web-based software that has provided me with valuable insights into how to build Windows 8 applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.0.85