ebook img

Real World Windows 8 Development PDF

479 Pages·2013·83.537 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Real World Windows 8 Development

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author ����������������������������������������������������������������������������������������������������������������xv About the Technical Reviewer ������������������������������������������������������������������������������������������xvii Acknowledgments �������������������������������������������������������������������������������������������������������������xix Introduction �����������������������������������������������������������������������������������������������������������������������xxi ■ Part 1: Knowing the Ecosystem ��������������������������������������������������������������������1 ■ Chapter 1: Introduction to Windows 8 �������������������������������������������������������������������������������3 ■ Chapter 2: Modern UI Design �������������������������������������������������������������������������������������������11 ■ Part 2: Getting Started ��������������������������������������������������������������������������������25 ■ Chapter 3: The App Platform and Developer Tools ����������������������������������������������������������27 ■ Chapter 4: The Right Controls ������������������������������������������������������������������������������������������39 ■ Chapter 5: The Look and Feel ������������������������������������������������������������������������������������������61 ■ Chapter 6: Content Structuring and Navigation ���������������������������������������������������������������87 ■ Part 3: Into the Groove ������������������������������������������������������������������������������107 ■ Chapter 7: Orientation and View States�������������������������������������������������������������������������109 ■ Chapter 8: Handling Data �����������������������������������������������������������������������������������������������129 ■ Chapter 9: Application Life-Cycle Management ������������������������������������������������������������147 ■ Chapter 10: Contracts ����������������������������������������������������������������������������������������������������173 ■ Part 4: The Bling ���������������������������������������������������������������������������������������223 ■ Chapter 11: Media and Sensors ������������������������������������������������������������������������������������225 ■ Chapter 12: Tiles, Badges, and Toasts ���������������������������������������������������������������������������257 iii ■ Contents at a GlanCe ■ Part 5: Above and Beyond ������������������������������������������������������������������������291 ■ Chapter 13: Cloud Augmentation �����������������������������������������������������������������������������������293 ■ Chapter 14: Live Services Integration ���������������������������������������������������������������������������369 ■ Chapter 15: Real-World Techniques ������������������������������������������������������������������������������407 ■ Chapter 16: Deployment ������������������������������������������������������������������������������������������������445 Index ���������������������������������������������������������������������������������������������������������������������������������459 iv Introduction I could say a thousand things here to introduce you to Windows 8 application development. But at the end of the day, everything boils down to your passion and excitement as a developer on the Microsoft technology stack. Windows 8 represents a significant opportunity for developers of both consumer-facing and enterprise apps. The whole Microsoft ecosystem is going through a huge change, based around mobile lifestyles, and our skills need to catch up if we developers want to stay on the cutting edge. So, buckle down, roll up your sleeves, and get coding with me. This is an exciting new world and the potential for you to make a name for yourself is huge. Also, as you build your Windows Store apps, let’s keep the conversation going. I am sure that you will have unique problems that you will have solved, or that you will find faster, better ways of accomplishing the same result. I want to know about these, since we developers make up one giant community and we support each other. So reach out to me with questions, concerns, or comments through Twitter; you can find me at @samidip. Let’s talk—and happy coding! xxi Part 1 Knowing the Ecosystem Windows 8 and the modern user experience represent a big change in Microsoft software and what it means for its future. Developers need to understand and truly enjoy the Microsoft ecosystem to be successful Windows 8 application developers. Understanding the synergy between the PC, tablets, smartphones, the cloud, and Xbox gives us depth in knowledge that helps plan a Windows 8 application correctly. We start this book by digging into the history, inspiration, and vision behind Windows 8 and the Microsoft ecosystem as a whole. Chapter 1 Introduction to Windows 8 “Windows reimagined” has been a buzz phrase since Microsoft first announced Windows 8 late in 2011. Marketing aside, one needs to look no further than the software coming out of Redmond, WA, to realize the message between the words. Microsoft put together a monumental 2012—just about every product division saw major software updates rolled out for industry-leading products. What began as a user interface (UI) design overhaul for smaller form factors has been renamed “Modern UI,” and it has spread its influence throughout the ecosystem of Microsoft products. At the pinnacle of this new wave of changes is Windows 8—the flagship Microsoft product and, arguably, the world’s most popular operating system. The stakes are huge, the quality of work is premium, and the excitement is palpable. This is no longer just Windows reimagined—it is truly Microsoft reimagined! Windows is an operating system (OS) used by computer users worldwide for work and at home. International Data Corporation (IDC) estimated in March 2012 that some 690 million PCs across the world used Windows 7. Add to that the PCs using Windows XP or earlier versions of Windows. It does not take a genius to figure out that Windows has a huge consumer base. And when there is an upcoming change to something so fundamental affecting many millions of people across the globe—it is a big deal. Windows 8 does not feel like an incremental OS upgrade; it truly is Windows built from the ground up, as you shall see throughout this book. I’ll peel back some of the layers of thought that went into Windows 8, discuss what Windows 8 means for consumers and enterprises, and most importantly to readers of this book – the developers, I’ll talk about how things boil down for developers, and how we leverage several technologies/frameworks to create Windows 8 Store Apps. Rest assured, Microsoft’s enormous consumer base and the significance of Windows 8 makes this one of the biggest opportunities application developers have had in a while. The State of Computing Before moving on, I’d like to provide a little perspective on the history of Windows 8. It reveals the bigger picture and context of where Windows 8 fits amidst the competition. It’s 2013 and computing as we know it is definitely going through a huge change. Human-computer interaction is evolving as our needs for on-the-go computing dictates tremendous innovation across computer form factors. There is no denying that Apple ushered in a whole new industry of smartphones with the 2007 launch of the iPhone. Since then, we are no longer content carrying cumbersome pagers or flip phones that just make phone calls. We want to have the Internet at our fingertips. Enter the modern smartphone: an all-in-one device that fits in our pockets and keeps us connected to work, family, and friends. Add to that real-time news, weather, maps, reviews, social media immersion, and other ways of staying connected—it’s no wonder we no longer simply make phone calls with our smartphones. The convenience of having a device that is always on, always connected, and ready to work purely with touch interaction, soon led to an App phenomenon: the need to control the various aspects of our lives and interactions through native applications built for smartphones. This brought on the explosion of the App Store model—a global but localized secure repository of Apps for our smartphones. These stores/marketplaces are mostly curated and maintained by the smartphone OS manufacturers. The submission and vetting process to get Apps from developers 3 Chapter 1 ■ IntroduCtIon to WIndoWs 8 into the store is meant to give users confidence in the quality and safety of Apps downloaded from the store. This model has proven to be tremendously beneficial for developers of Apps, providing a global audience/customer base of users and monetization through paid Apps, Apps with advertisements, or in-App purchases leveraging existing e-commerce models. November 2010: Microsoft launches Windows Phone 7. A completely new smartphone OS, written from the ground up and aimed at invigorating the Windows brand in the smartphone industry. With Apple and Google already out there for several years with their mobile OS offerings, the challenge was to do something fresh and exciting. What began with the Zune HD a couple of years back was a new kind of UI paradigm focused on content over chrome—and the user’s lifestyle at the center of it all. With Windows Phone, this UI (first called the Metro design language) was now all grown up. It offered a breath of fresh air to the user experience. Delightfully touch-oriented, Windows Phone OS excels at being fast and fluid, and offers complete personalization in putting the users’ content and lifestyle at the center of the experience. No longer are we stuck with a grid of application icons. Apps come to life through what are called live tiles —visual, live representations of Apps (even when they are not running). Live tiles are updated locally or through push notifications from the cloud. They are a big selling point of the ecosystem, always inviting users back to the applications. Windows Phone also represents the best effort thus far toward bringing all of the Microsoft ecosystem service offerings (Xbox, Office, Live Services, etc.) together in one, shiny hardware device. It might take Windows Phone a while to claw its way to the market share it deserves, but the innovation offered by the new platform is undeniable. Even better is the developer story. Because it’s based on the Silverlight runtime, developing Apps for Windows Phone is a lot of fun for .NET developers, resulting in Windows Phone being the fastest-growing App marketplace/store among its peers in quickly reaching the 100K-App milestone and growing. There is, however, a new kid on the block: the tablet form factor. As much as we love our smartphones, they are rather small devices for content consumption, multitasking, and business workflows. Users want an always-connected/ always-on experience—but on a bigger form factor, which lends to expanded computing reach. Razor-thin, lightweight, and touch-friendly—tablets quickly grabbed consumer attention, and the computing transformation was well on its way. It didn’t take the casual computer user, netizen, gamer, socialite, and movie buff long to realize that they didn’t need a bigger computer—a touch-friendly tablet would likely meet most of their needs. Enterprises also began considering their line-of-business workflows for the mobile employee base; and the consumerization of IT became a reality. With the introduction of the iPad, Apple again pioneered the space; but it did not take the competition much time to see the iPad’s shortcomings and come up with more compelling offerings. Windows 8: The Overview October 26, 2012, was the launch date for the general availability of Windows 8. Amid the waves of computing change, came an OS that promised to offer no compromises on a variety of form factors. Windows 8 takes everything good about Windows 7 and tries to make it better. With full backward compatibility in Windows 8 Pro for applications running on Windows 7, the upgrade to Windows 8 promises to be painless. In addition to the desktop goodness, Windows 8 shines with its whole new UI, optimized for touch interaction. The ubiquitous Windows Start menu is no more! Instead, users get a full-screen Start touch menu—highly customizable, personal, and filled with live tiles that invites users back to their applications. The Start screen offers a brand-new Windows 8–specific user experience. It is the biggest change introduced in Windows since Windows 95. Figure 1-1 shows a sample of the Windows 8 Start screen experience. 4 Chapter 1 ■ IntroduCtIon to WIndoWs 8 Figure 1-1. The Windows 8 Start screen The Windows 8 Start experience captures a lot of what Windows 8 craves to be: the one OS across all device form factors. Touch is not an afterthought; it is a first-class citizen. Equally supported are mouse and keyboard interactions. The Start screen is not a list or grid of application icons, but rather each App gets its own tile, which comes in two sizes: square or wide. The tile is not just an application shortcut; it is like a live representation of the App, conveying information to the user from the Start screen itself, without having to run the App. Live tiles, which update locally or from the cloud, started in Windows Phone and are all grown up in Windows 8. There are several combinations of text, pictures, and badges that make up a live tile, along with peek animations and the ability to cycle through content, leading to an energetic, inviting, and constantly alive Start screen experience. Modern UI, which also began with Zune and Windows Phone, has center stage in the Windows 8 touch experience. The mantra is simple and minimalist, fast and fluid, content over chrome, rich use of bold flat colors, animations for liveliness, and putting the user first. The Windows 8 Start experience is full-screen and offers discoverability and personalization. The point is to make everyone’s Start screen look different; users are free to move Apps around and arrange tiles based on what’s important to their individual style and the given PC. The Start screen content can pan left or right, but a feature called Semantic Zoom aids superbly in discoverability and navigation. To use it, you simply pinch the Start screen, or if you’re on a traditional PC, you hold down the Ctrl key while scrolling the mouse scroll wheel. You are taken (with an easing animation) to a zoomed-out view of smaller App tiles that show the whole layout grouped in sections, as if from a height above. Pinch or scroll out, and you return to the regular Start screen tiles. In addition to Semantic Zoom, another feature that aids in personal organization is grouping, which enables you to group the Start screen tiles easily into logical buckets, based on App types and position groups of tiles by preference. Grouping, combined with Semantic Zoom, is helpful with organization and way finding—simply zoom out, and then swoop back in on the App group of interest. Figure 1-2 shows my personal Start screen, with tile groupings under Semantic Zoom to give a feel for what’s doable. The goal is to personalize to your heart’s content. Windows is suddenly fun again—modern, fast, and colorful yet utilitarian! 5 Chapter 1 ■ IntroduCtIon to WIndoWs 8 Figure 1-2. The Windows 8 Start screen with grouped tiles under Semantic Zoom The Form Factors It is no surprise that Apple’s iPad dominates the tablet space, with Google Android–based tablets trying to wrestle away some of its market share. Tablets have captured the consumer imagination, and innovative computing scenarios are coming forward. For kids and younger generations, touch interaction comes naturally and computing is much more personal. Entire stacks of books or movie collections can be placed on a single tablet; and the thin and light form factors ensure ultimate mobility. There is one minor problem, however, that most would agree on: as handy as today’s tablets are, they are mostly meant for consumption of content. While this works for the majority of folks, advanced users like developers might also want to do some actual work on tablets. Although there are competing products, Microsoft Office documents continue to be heavily used worldwide, but they are non-native citizens on today’s tablets. Serious development work is possible only if the developer is remotely logged in to computers that are more powerful. Arguably, part of the problem is because both Apple and Google choose to use a mobile OS on their tablets. Although this approach is definitely working in terms of simplicity and market share, does it still leave something to be desired? Can work and play be combined? Microsoft is definitely not new to tablets. There have been several experiments with the form factor, starting in the early days of Windows. The problem was that although Windows supported touch, the user experience was geared toward laptops and desktop PCs. This meant Original Equipment Manufacturers (OEMs) often tried putting their own touch-enabled skins on top of Windows, leading to somewhat clunky and inconsistent user experiences. Windows 8 throws away all of that clutter from the past and embraces touch first. The whole point is an uncompromising, single OS across all PC form factors, as shown in Figure 1-3. Windows 8 belongs in touch-based tablets and all-in-one PCs; but it is also perfectly comfortable with the mouse-keyboard setups of desktops and laptops. The point is that no matter your PC hardware, you get the same consistent user experience (UX) with Windows 8. 6

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.