
Chapter 1 Introducing Windows 8 In This Chapter ▶ Getting a grip on the new Windows ▶ Starting fast out of the gate with Hello World ▶ Deciding what development technology to use ▶ Making sure that you put users first or some of you, this chapter is an introduction, for others, a reminder. FWindows 8 uses the same interface pattern used by Xbox Live and the Windows Phone. If you have used either, you know Windows 8. Welcome to a new world of Windows. A lot has changed since Windows 3.1 gained general popularity in 1991, both in terms of devices available to host an operating system and the bandwidth necessary to connect them. Sometimes Microsoft has blazed a trail, some- times they have fallen behind, but Windows has always managed to more or less stay abreast of the world of computing. Tablets are a story of both greatness and woe. Windows XP was tablet-ready, but the hardware world wasn’t. We ended up with five-pound tablets that had a three-hour battery life and required a stylus. Apple and Google surged ahead as soon as the hardware was truly ready for the form factor. Microsoft has an ace in the hole, though. Windows is present on 250,000,000 devices worldwide,COPYRIGHTED and some of them are MATERIAL even legally licensed. Windows runs the majority of businesses on the planet. It is everywhere. Windows 8 is not just a tablet operating system (OS). Microsoft has not chosen to make a separate OS for devices and phones like Apple has. They are upgrading the core OS to handle tablets natively. This means that the most popular OS on the planet, with the best developer tools on the planet, will soon work on tablets and have an app store like Google and Apple. That, in a word, is huge. 005_9781118173350-ch01.indd5_9781118173350-ch01.indd 9 110/23/120/23/12 110:420:42 PPMM 10 Part I: Discovering Windows 8 You see, rather than writing an app that works on one version of, say, six mil- lion Android phones out there, or that works on the iPhone 4S and nothing else, you can write something that works on nearly everyone’s laptop. Then you can test it, market it, and sell it online with automagic installation, just like on those phones and tablets. It’s a much, much bigger pond to fish in. But wait, there’s more! In order to do this, you probably need to learn Windows Presentation Foundation and C# and a bunch of other junk that you have never needed before and won’t ever need again, right? No. You can build native Windows applications with HTML and JavaScript, just like you build web pages. That is worth saying again. You can build native Windows applications for Windows 8 using HTML and JavaScript. But I’m getting ahead of myself. In this chapter, I cover what Windows 8 is, how you code for it, and how it fits into the grand scheme of your overall software development practice. Finding the Path If you have followed the Microsoft developer experience for any number of years, you probably know that it follows a logical path. As Microsoft has embraced the open web more and more, they invest more and more in tools to make programs for normal people rather than line-of-business applications. Access, FrontPage, and even Visual Basic 6 (VB6) can be described as Microsoft technologies for power users. They feature the core Microsoft Development technologies (OLE, ASP, and VBScript) but have template code and complete graphical user interfaces (GUIs) to make the product easier to use, if less functional. What’s been missing are tools for professional programmers — or good hobbyists — to make simpler consumer-grade programs that look great. There were no tools and no platform for this: People were on their own. With Windows 8, Microsoft is changing that. You can get a preview of their path by looking at the Xbox and the Windows Phone. Apple and Google are spearheading a trend toward nice-looking, single-user apps, and Microsoft is right there. Figuring out where Microsoft is headed But how exactly is Microsoft working into the consumer market for apps? And where is the endpoint? 005_9781118173350-ch01.indd5_9781118173350-ch01.indd 1010 110/23/120/23/12 110:420:42 PPMM Chapter 1: Introducing Windows 8 11 The plan is large and sophisticated, but by focusing on just the stuff that mat- ters, you can get a clear view of it. In this chapter’s introduction, I mentioned the existing Windows 8 applications in the Windows world — Xbox and Windows Phone. Figure 1-1 shows those two alongside a Windows 8 tablet, and the similarities are clear. ab Figure 1-1: Examples of Windows 8 in the wild. c 005_9781118173350-ch01.indd5_9781118173350-ch01.indd 1111 110/23/120/23/12 110:420:42 PPMM 12 Part I: Discovering Windows 8 You can tell, just by looking at the applications, that Microsoft is trying to do a couple of things: ✓ Optimize for touch: It doesn’t matter if you are using a finger on a Windows Phone, a Kinect on the Xbox, or a stylus in Windows 8 — the user experience is driven by touch. ✓ Let users focus on one thing at a time: Look at your PC. Every application has a menu and status bar. There is a menu and status bar on the OS itself! The idea is to increase productivity by easily switching between tasks. It’s a multitasker’s dream. Windows 8 isn’t like that: It’s all about one thing at a time. ✓ Focus on consumption, not creation: All three platforms are more for reading blog posts than writing them, watching movies rather than making them. If you want to create content, change to the desktop. Does this mean that Windows desktop apps are dead as we know them? Not at all. The Windows 8 experience, effectively, is an addition to the regular Windows 7 experience. It really is just an enhanced Start bar that can run applications of its own. Building a simple Hello World app Before you get started building a Hello World app, make sure you have these essentials: ✓ A Windows 8 machine with some input mechanism, preferably a keyboard and mouse ✓ Visual Studio 2012 ✓ Expression Blend Visual Studio runs on the desktop, although you access it from the Windows 8 Start screen. Figure 1-2 shows my tablet’s Windows 8 menu, with the Visual Studio icon on the center right. Give that a click, and you are off to the races. To get an idea of how a Windows 8 application works, your best bet is to build a (very) simple one. 005_9781118173350-ch01.indd5_9781118173350-ch01.indd 1212 110/23/120/23/12 110:420:42 PPMM Chapter 1: Introducing Windows 8 13 Figure 1-2: My Windows 8 menu screen. Basically, Windows 8 applications that use HTML5 as the user interface markup are constructed using an HTML file, a Cascading Style Sheets (CSS) file, and a JavaScript file that are compiled into a package. Although it’s pos- sible to just take an HTML application for the web and run it in Windows 8, if you want to make use of any Windows-specific features, you need to branch out a little. 1. Open Visual Studio 11 by clicking the icon in the Windows 8 menu. 2. Click New Project in the upper left corner of the designer to start a new project. You’ll see the New Project dialog box, as shown in Figure 1-3. 3. In the tree view to the left, select Templates➪JavaScript➪Microsoft Store. 4. In the window to the right, select the Blank App template. This gives us the bare essentials for creation of a new application. 5. In the Name field, enter Hello World. Why be original, right? 6. Click OK. 005_9781118173350-ch01.indd5_9781118173350-ch01.indd 1313 110/23/120/23/12 110:420:42 PPMM 14 Part I: Discovering Windows 8 Figure 1-3: Starting a new project. Visual Studio grunts and growls for a minute, and then gives you the basic files for a Windows 8 application. These consist of the following: ✓ Default.html: The starting form, page, window, view, and what have you for the Windows 8 application. This is where you lay out the form. ✓ Default.css (in the CSS folder): This file is referenced by default.html. It is unsurprisingly the starting location for style sheet information. This is where you set fonts, colors, and locations of items in the HTML file. ✓ Default.js (in the JS folder): The JavaScript file is also referenced by default.html. This is where the application loader looks for hints on how to get the application up and running. All application logic goes in .JS files. ✓ Hello World_TemporaryKey.pfx: This is the key you use to sign your app before it goes to the store. Eventually, you’ll have an organizational key. I’ll handle all of that in Part IV. ✓ Package.appxmanifest: The most interesting file in the batch, this is a mashup on the Project properties, Deployment config, and app.config of the .NET world. You don’t have to have all of these files. The only required files are default. html and package.appxmanifest. Just like with a regular HTML-based web page, the JavaScript and CSS can be introduced directly in the HTML. Also, you can use multiple JS files and reference them all, and cascade the CSS as usual in CSS3.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages16 Page
-
File Size-