Index

„ „ A templates Blank App template, 31 AccountSettingsFlyout.xaml, 380 Grid App template, 31–32 ADO.NET Entity Data Model, 315 Split App template, 31–32 connection config, 313 touch-centric Windows 8 OS and Store Apps, 28 database connectivity, 312 traditional Windows desktop, 28 existing database, 311 user interface, 29 table selection, 314 Visual Studio usage, 310 blank App solution, 34–35 AppBar controls components of, 35–36 click-event handlers, 56 debugging, 33 code, 55 local machine, 34 context-sensitive icons, 57 remote machine, 34 context-specific commands, 54 simulator, 34 icons, 54 App Store model, 3 Page placeholders, 56 App.xaml.cs, 78 Snapped/Portrait modes, 54 ApressBookModel.edmx file, 314 StackPanels, 56 ApressBooks, 318 with StaticResources, 56 ApressCloudService, 316, 321 top and bottom, 56 ApressDemo, 61 Application data, 129 Apress Featured Books Demo app, 74 Application life-cycle management ApressODataService, 316–317 async-await and race conditions (see Async-await ApressShareTargetDemo, 185 and race conditions) Async-await and race conditions background agents (see Background agents) advantage, 160 events (see Events) APM, 159 process, 147–148 Apress demo app, 162 timing and debugging (see Timing and code leading, 160 debugging) collection of books, 162 AppName, 45 custom data persistence, 160 Apps EAP, 159 application frame, 33 life-cycle events persistence, 161 backstacks, 33 AsyncCallBack, 334 coding in App.xaml file, 36 Asynchronous Programming Model (APM), 159 core kernel, 28 Attached properties, 42 development language, 29 Azure mobile services, 339 OnLaunched() method, 36 app identification, 344 OnSuspending(), 37 Store advanced app configuration features, 344 software tools, 30 Store authentication credentials, 345

459 ■ index

Azure mobile services (cont.) „ „ C app setup Store app name, 343 Canvas control, 42 Store app name selection, 344 CheckBox controls, 52 Store association, 343 Cinematography, 22 Windows Store dashboard, 342 Cloud augmentation dashboard, 361 cloud computing data table, security, 360 benefit of, 294 mobile services portal, 340 definition, 293 in preview mode, 341 IaaS, 293 SDK, 351 PaaS, 293 client DLL reference, 352 SaaS, 294 install, 352 OData, 306 service-app handshake, 349 CRUD, 333–335 service operations, client custom OData queries, 335–336 app bar button icon, 354 filtering, 336 App.xaml.cs file, 355 Netflix, 305 data table dynamic schema, 355 paging, 337 data table insert, 356 service integration, 326–332 management keys, 353 push notification service setup framework, 337 dashboard, 347 steps, 338 database configuration, 346 service creation process, 306 database new table, 348 service setup code, 317 database settings, 346 user authentication new mobile services, 345 custom authentication in table schema, 349 code, 365–367 service-side scripting service data protection, 360–361 data table custom authentication, 361–365 scripting, 357 Windows Azure, 294 data table scripting, 357 data persistence, 297–302, 304 scripting help, 359 mobile services, 340–359 toast notification, 358 MSDN benefits, 295–296 Twitter credentials in, 365 service deployment, 322 service packaging, 321 Collection controls „ „ B Application title, 45 Background agents Apress books collection, 47 Appxmanifest XML book class, 46 extension, 167 data binding (see Data binding) code execution, 170 FlipView, 43 debugging, 170–171 FlipViewDemo.xaml, 43 definition, 164 Grid control, 45 new project, 164 GridView, 43 Package.Appxmanifest ItemContainerStyle property, 43 declaration, 166 ItemsControl hierarchy, 42 reference manager, 168 ItemSource property, 43 registration, 168–169 ListView, 43 solution explorer, 165 MVVM software, 46 Badges, 278–280 Page title, 45 BookDetails.xaml/cs, 93 SemanticZoom, 43 BookGroupsByTechnology.xaml/cs, 93 static FlipView demo, 44–45 Boxology, 88 static images, 45 Button controls, 54 StaticResource, 45

460 ■ Index

CollectionViewSource, 79 photos, 184–185 ColumnDefinition, 42 Request.Data property, 178 ComboBox controls, 53 Rowi app, 178–179 Component Object Model (COM), 29 SetText() method, 178 Container controls, 42 share source app, 182–183 Content structuring planning target contract, 185–189 boxology, 88 text share, 178 information architecture, 88 URI link, 181 rules, 87 Controls wireframing, 88 collection (see Collection controls) Contracts container, 42 extensions, 173 filter/navigation (see Filter/navigation controls) file picker contract framework and namespace , 39 App Bar icon, 216–217 placeholders, 40 code, 217 selection, 52 declaration, 216 transient UI, 57 enumeration values, 218 MessageDialog, 57–58 File Save Picker, 221–222 Progress controls, 58 multiple file select, 220–221 ToolTip, 58 single file select, 219–220 Create, read, update, delete (CRUD), 333 SuggestedStartLocation property, 218 database, 334 search XAML page, 335 author name filter, 202–203 CreateTileUpdaterForSecondaryTile() charms menu option, 189–190 method, 277 CollectionViewSource, 200 Custom authentication, 365–367 DefaultViewModel, 199 Custom data persistence drop-down search filter, 203–204 DataContractSerializer, 138–139 empty search, 201 local hard drive, 138 filters, 196–197 network calls, 137 implementations, 192–196 real-world scenario, 137 LoadState() event, 199 serialized XML, 138–139 query suggestions, 205–206 result suggestions, 204, 206–208 SearchActivatedEventArgs, 199 „ „ D SearchResultsPage.xaml.cs file, 199 Data binding user search, 190–192 with FlipView VisualState XAML markup, 201 data display, 51 working search, 200 DataTemplate, 49 XAML markup, 197–199 global data placeholder, 49 settings global properties, 47 flyout menu, 215 items addition/removal, 51 implementation, 210–211 ItemsControl, 49 10 app, 208–209 ItemSource, 50 menu option, 208–209 ItemTemplate, 49 SettingsFlyout control, 210 Load ViewModel method, 48 user control, 211–214 replacing hard-coded images, 49 share showing item, 50 anatomy, 175–176 StackPanel, 49 BookDetails.xaml.cs page, 177 with ListView, 51 charms bar integration, 174–175 Data-bound Grid template, 72 DataRequested event, 177 Data handling DataRequestedEventArgs arguments, 178 application settings DataTransferManager, 177 local storage, 131–132 FeaturedBookList.xaml.cs file, 179 roaming storage, 132–134 FlipView controls, 178 data containers, 129 HTML, 182 data types, 129 461 ■ index

Data handling (cont.) Events file system OnLaunched, 149 code debugging, 135 OnLaunch handler, 149–150 custom data (see Custom data persistence) resuming, 149 local storage persistence, 135 suspending, 149 root storage directory, 136–137 XAML Pages, 151 sample file, hard drive, 135–136 relational data ApressBooks, 143–144 „ „ F build configuration, 142 FeaturedApressBookListViewModel class, 78 code debugging, 146 FeaturedApressBooks collection, 162 compile error, 142 FeaturedBookListVM ViewModel, 80 database file, SQLite, 145 FeaturedBooklist.xaml/cs, 93 definition, 140 Fierce reductionism, 15 Entity Framework, 143 Filter/navigation controls persistence, SQLite, 144–145 AppBar project reference, 141 click-event handlers, 56 RelationalApressBookModel, 145 code, 55 SQLite, 140–141 context-sensitive icons, 57 sqlite-net, 143 context-specific commands, 54 Windows 8 Store app, 140 icons, 54 storage targets, 130–131 Page placeholders, 56 DataPackage, 176 Snapped/Portrait modes, 54 DataServiceCollection, 331, 334–335 StackPanels, 56 DataServiceContext, 331, 334 with StaticResources, 56 DataTemplate controls, 49–50 top and bottom, 56 DataTemplates, 43 Button, 54 DefaultViewModel, 80, 100, 106 FlipView control, 43 Dependency properties, 41 Flyouts, 19 Device orientation Frame hierarchy, 40 Apress Books Demo app home screen, 111 landscape-flipped mode, 111, 113 „ „ G portrait-flipped mode, 111, 114 Grid App template pages, 92 portrait mode, 111–112 Grid App templates, 31 code Grid control, 42 Basic Page template, 116 GridView control, 43 detection, 116, 117 GroupDetailPage.xaml/cs, 92 MSDN documentation, 118 GroupedFeaturedApressBooks, 80 orientation sensor, 117 GroupedItemsPage.xaml/cs, 92 StartLayoutUpdates() method, 116 Grouping, 5 WinRT operation, 117 GroupStyle.HeaderTemplate, 96 configuration file, 115–116 orientation, definition, 109 rotational, 110 „ „ H tablet flipping, 111 Hotmail, 371 Windows 8 tablet, 109–110 HTML5 and CSS3, 29 DirectX, 29 Hub-and-spoke model Apress Featured Books Demo BookDetails.xaml/cs, 93 „ „ E BookGroupsByTechnology.xaml/cs, 93 .edmx file, 314 BookGroupsByTechnology.xaml Page, 98 EntitySetRights, 318 FeaturedApressBooks, 94 EntitySetRights.All, 318 FeaturedBooklist.xaml/cs, 93 Event-based Asynchronous Programming (EAP), 159 Group Details page, 96, 98

462 ■ Index

grouped collections, books, 95 ItemsControl hierarchy, 42 GroupedFeaturedApressBooks, 94 ItemSource property, 43 Home page, 93 ItemTemplates, 43 Item Details page, 102–103, 105 DefaultViewModel, 106 „ „ L FlipView control, 105 Grid App templates, 91 Language projections, 30 GroupDetailPage.xaml/cs, 92 LaunchActivatedEventArgs, 276 Group Details page, 100 LayoutAwarePage, 80, 90, 156 GroupedItemsPage.xaml/cs, 92 LayoutAwarePage class, 89 IE10 Windows 8 browser app, 91 LayoutAwarePage.cs file, 90 ItemDetailPage.xaml/cs, 92 Life cycle application, 147 LoadState method, 106 ListBox controls, 53 navigation patterns, 91 ListView control, 43 HyperText Transfer Protocol (HTTP), 407 Live Services account settings, 385–386 App management, 405–406 „ „ I, J, K App permissions, 389 IBackgroundTask interface, 165 check implementation, 389 Image tile templates, 267–268 contacts list, 393, 395 Implementing semantic zoom core scopes, 375, 377 Apress Featured Books Demo app, 74 custom user controls, 380–383 data model, 74–76 extended scopes, 375, 377 GridView, 73 fetching user data, 392–393 UI Markup, 80 in-app authentication status, 385 Apress Featured Books Demo app, 82, 86 integrating authentication, 378–380 CollectionViewSource, 79, 85 Live connect data binding, 80 access control, 371 data context, 80 benefits and considerations, 370–371 DataTemplate, 84 Hotmail, 371 GridView, 83 industry standard protocols, 370 IsSourceGrouped, 79 Live Connect developer ItemTemplate, 83 portal, 371–372 LayoutAwarePage, 80 messaging capabilities, 371 OnNavigatedTo() event, 80 SkyDrive, 371 page resources, 79 Skype, 374–375 XAML Markup, 80 , 369 Zoomed-In data template, 83 Microsoft account sign-in, 390 Zoomed-In View, 82 privacy statement settings, 384 Zoomed-Out data template, 85 SaaS, 369 Zoomed-Out View, 85 SkyDrive (see SkyDrive) ViewModel, 77–79 user’s calendar, 395, 397–398 Independent software vendor (IVS), 447 user sign-in, 386–387 Information architecture, 88 user sign-out, 388 Infrastructure as a Service (IaaS), 293 Live tiles, 4, 261–262 INotifyCollectionChanged interface, 47 LoadState method, 100 INotifyPropertyChanged (INPC) Lock Screen Apps interface, 47 configuration pattern, 76, 430 Apress demo app, 286 InterOp, 29 badge update, 288 iPad, 4 lock screen permissions, 287 iPhone, 3 PackageAppxManifest Declarations tab, 285 Isolated storage, 130 PackageAppxManifest file, 284 IsSourceGrouped property, 79 detailed status, 288, 290 ItemContainerStyle property, 43 Windows 8 lock screen, 284 ItemDetailPage.xaml/cs, 92 LoginAsync() method, 366

463 ■ index

„ „ M snap and scale, 22 toast notifications, 23 MainPage.xaml.cs, 40 transiency, 19 ManageCloud.xaml, 329 typography, 18 Media playback Windows 7 application, 14–15 access declaration, 243 Windows 8 OS, 23 code, 245 Windows CE, 11 FileOpenPicker, 245 , 12 local media picker, 245 Windows 8 Store App developers, 11 local media playback, 246 HD , 11 local file, 243–244 MSDN, 173 MediaElement control, 244–246 Media.xaml page, 243 stream media, 246–248 „ „ N updated app bar, 242 Navigation models, 20 XAML markup, 242 Navigation patterns, 91 MessageDialog controls, 57–58 Netflix OData, 305 design language, 4 Microsoft ecosystem, 12 Model-View-View Model (MVVM), 46 „ „ O behavior, 440 command binding, 440 Object-relational mapping (ORM), 309 commands, 438 ObservableCollections, 47 components, 429 Onlaunched() method, 79 DataContext, 430 OnNavigatedTo() event, 80 design pattern, 429 Open Data Protocol (OData), 306 light toolkit, 430 CRUD, 333 repository, 431 database, 334 ViewModel, 433 XAML page, 335 ViewModelLocator custom OData queries, 335–336 App.xaml file, 435 definition, 304 Apress demo app, 438 filtering, 336 decoupling, 434 local OData endpoint, 319 ListView model, 437 local OData entity, 320 MVVMFeaturedBookList.xaml, 436 Netflix, 305 ServiceLocator, 435 paging, 337 XAML Commands, 430 service integration Modern UI design language app bar icon, 329–330 Microsoft, 11 consumption, 330–332 Microsoft ecosystem, 12 OData service reference, 328–329 principles WCF data services tools, 326–327 authentically digital, 14 UI binding, 331 content-over-chrome doctrine, 13 ecosystem, 14 fast and fluid, 13 „ „ P, Q Windows 8 weather App, 12–13 PackageAppXManifest traits configuration, 115–116, 259, 265 animations, 22 Packaging process contracts, 23 app name selection, 451 edges, 18 appxupload file, 452 fierce reductionism, 15 architecture configuration, 452 layout, 15–17 sideloading, 450 navigation mechanism, 20 visual studio, 448 secondary live tiles, 23 Windows Store, 449 Semantic Zoom, 20–21 wizard completion, 453

464 ■ Index

Page hierarchy, 41 Semantic Zoom, 5–6, 20–21, 73 Page navigation, 89, 91 SemanticZoom control, 43 Peek tile templates, 269–270 Sensors Platform as a Service (PaaS), 293 accelerometer, 251–252 PrivacyStatementSettingsFlyout.xaml, 380 compass, 248–250 Progress controls, 58–59 gyrometer, 253–254 inclinometer, 252–253 light sensor, 255–256 „ „ R Server-sent events (SSE), 408 RadioButton controls, 52 SignalR Real-World technique back-end server, 409 building, 407 addChatMessage(), 412 forever frame, 408 ASP.NET SignalR NuGet, 411 HTTP, 407 ChatHub, 411 long polling, 407 Global.asax.cs, 413 periodic/Ajax polling, 407 Layout.cshtml, 414 plug-ins, 408 ModernUI.css style sheet, 413 server-sent events (SSE), 408 MVC 3 web application WebSockets, 408 template, 410 MVVM (see Model-View-View Model (MVVM)) PushMessageToClients(), 412 programming pattern, 427 RouteTable.Routes.MapHubs(), 413 SignalR (see SignalR) front end WinRT.MetroGridHelper, 442 ActionResult, 415 Remote debugging addChatMessage() method, 417 configuration, 228–230 chatroom server, 418 deployment, 230–231 chatroom UI, 415 tools installation, 225–228 Home controller, 415 RESTful service, 305 jQuery, 416 RowDefinition, 42 PushMessageToClients() method, 417 start() call, 417 „ „ S powered Windows 8 App ScheduledTileNotification, 271 Apress demo app dashboard, 419 SecondaryTile.RequestCreateForSelectionAsync(), 274 chatroom implementation test, 422 Secondary tiles integration, 420 app bar icon, 273 .NET Client NuGet, 420 Apress demo app, 272 from server to Windows 8, 424 CreateTileUpdaterForSecondaryTile() test and wrap up, 425 method, 277 from Windows 8 to server, 423 FlipView control, 274 Skeuomorphism, 14 flyout, 274–275 SkyDrive, 131, 371 LaunchActivatedEventArgs, 276 contents list, 401 OnLaunched() event handler, 276 definition, 399 pinning and unpinning, 276 signed-in user, 400 Pin To Start icon, 273 updation, 402–404 SecondaryTile.RequestCreateForSelectionAsync(), Windows 8 app, 399 274 Skype, 374–375 single parent app, 272 Slider controls, 53 Start screen, 272 Software as a Service (SaaS), 294, 369 tileActivationArguments, 276 Split App templates, 31 uniqueTileID, 277 Square tile, 261 user taps/clicks, 276 StackPanel control, 42 Security identifier (SID), 338 StandardStyles.xaml file, 45 Selection controls, 52 SystemTriggerType, 169

465 ■ index

„ „ T ToggleButton controls, 53 Toggle controls, 53 Text tile templates ToggleSwitch controls, 53 App name configuration, 265 ToolTip controls, 58 PackageAppxManifest configuration, 265 Transient UI controls, 57 square tile update, 265, 267 MessageDialog, 57–58 TileManager’s CreateTileUpdaterForApplication(). progress controls, 58 Update() method, 264 ToolTip, 58 TileNotification, 264 Twitter authentication TileSquareText03, 263 developer portal, 362 TileUpdateManager’s GetTemplateContent new application, 362–364 method, 264 wide tile update, 267 XML template, 263–264 „ „ U TileManager’s CreateTileUpdaterForApplication(). Ultrabooks, 8 Update() method, 264 uniqueTileID, 277 TileNotification, 264 User data, 129 Tiles default, 258–259 image configurations, 260 „ „ V image tile templates, 267–268 ViewModel, 77–78 live tiles, 261–262 View states local tile updates, 262 Apress demo app notification queue, 271–272 filled mode, 124–125 PackageAppXManifest configuration, 259 full-screen mode, 124–125 peek tile templates, 269–270 high resolution, 127 scheduled updates, 270–271 snapped mode, 124, 126 secondary (see Secondary tiles) desktop and laptop, 118 square tile, 261 full and filled modes, 119 text tile templates (see Text tile templates) Manager Windows 8 Store apps, 258 code handling, 127 TileSquareText03, 263 wire-up, 124 TileUpdateManager object, 271 XAML mark-up TileWideText03 template, 263 adjustments, 120–123 Timing and debugging snapped mode, 119 AppExecutionStates, 158 Windows 8, 118–119 debugging through life-cycle events VisualStateManager, 98, 120 App Suspension plumbing, 155 asynchronous save and restore, 156 debugging resume, 155 „ „ W debugging suspension, 154 Webcam dictionaries and deferrals, 157 AccountPage.xaml, 233 guidelines, 151 asynchronous capture-photo responding to life-cycle events operation, 235 Debug Location menu option, 153 CameraCaptureUI, 234–235 Debug options, 154 declaration, 232 Resume/Suspend event front-facing camera, 236 handlers, 152 MediaCapture, 240–241 ToastNotificationManager, 283 Package.Appxmanifest file, 231 Toast notifications, 23 permissions settings, 239–240 anatomy, 281–282 photo cropping, 236 definition, 280 photo preview, 236 launch attribute, 283 template page, 234

466 ■ Index

updated app bar, 232–233 Enterprise line of business (LOB) usage warning, 235 PowerShell commands, 446 video capturing, 237–239 sideloading-enabled devices, 446 Web.Config file, 312 in-app purchases, 457 WebSockets, 408 packaging process (see Packaging process) Windows 8 trials, 457 discoverability and personalization, 5 WACK validations form factors, 6 failures and successes, 456 full-screen Start touch menu, 4 targets Intel-based/ARM-based grouping, 5 architectures, 454 history, 3 Windows Store live tiles, 5 apps submission, 447 Modern UI, 3, 5 certification process, 447 one ecosystem, 9 independent software vendor, 447 platform investments, 8 marketing, 447 Semantic Zoom, 5–6 personalized app dashboard, 446 Start screen, 4–5 WACK tool, 447 Zune and Windows Phone, 5 Windows developer portal, 447 Windows 8 app Windows 8 Notification Client Platform, 338 contracts (see Contracts) Windows Notification Service (WNS), 338 media playback (see Media playback) Windows Push Notification Service (WNS), 23 remote debugging (see Remote debugging) Windows Runtime (WinRT), 28 sensors (see Sensors) Windows 8 Store app. See also Apps webcam(see Webcam) App template Windows App Certification Kit (WACK), 447 data-bound Grid template, 72 Windows Azure discoverability, 72 Azure Web Role, 308 Grid, 71 mobile services (see Azure mobile services) GridView, 72 MSDN benefits, 295–296 screen resolutions, 69 .NET SDK, 306 Semantic Zoom, 73 new Azure service, 308 silhoutte, 71 service deployment Typographical ramp, 71 new Azure service, 322 Visual Studio Grid, 70 OData endpoint, 324 Visual Studio templates, 71 OData entity, 325–326 content structuring (see Content structuring service publication, 324 planning) service setup, 323 hub-and-spoke model (see Hub and-spoke model) service packaging, 321 images cloud packaging artifacts, 322 ApressDemo, 61 cloud packaging configuration, 321 Assets folder, 63 SQL Azure database, 297–299 Default app logo, 62 connection strings, 301 Default splash screen, 62 dashboard, 300 folder-naming convention, 70 firewall rules, 302 image configuration properties, 70 management portal, 302 Logo.png, 63 table data, 304 PackageAppXManifest file, 64 table schema, 303 SmallLogo.png, 63 WCF service, 308–309 splash screen, 67–68 Windows Communication Foundation (WCF) SplashScreen.png, 63 service, 306, 308–309, 316 square app tile, 63 Windows 8 deployment StoreLogo.png, 63 advertising, 457 tiles, 62 app price, 457 Visual Studio app package, 66

467 ■ index

Windows 8 Store app (cont.) „ „ X, Y Wide app tile and size toggle, 64 Wide app tile with app name, 65 XAML, 29 implementing semantic zoom (see Implementing x:class attribute, 40 semantic zoom) page navigation, 89–90 „ „ Z templated solution, 91–92 WinRT, 30 Zune HD, 4 WinRT.MetroGridHelper, 442 Zune HD portable media player, 11 Wireframing, 88

468