Summary Windows Store App Development introduces C# developers to working with Windows Store apps. It provides full coverage of XAML, and addresses both app design and development. Following numerous carefully crafted examples, you'll learn about new Windows 8 features, the WinRT API, and .NET 4.5. Along the way, you'll pick up tips for deploying apps, including sale through the Windows Store. And, of course, you'll find the same deep and unique insights Pete provides in his Silverlight books. About the Technology The Windows Store provides an amazing array of productivity tools, games, and other apps directly to the millions of customers already using Windows 8.x or Surface. Windows Store apps boast new features like touch and pen input, standardized app-to-app communication, and tight integration with the web. And, you can build Windows Store apps using the tools you already know: C# and XAML. About this Book Windows Store App Development introduces the Windows 8.x app model to readers familiar with traditional desktop development. You'll explore dozens of carefully crafted examples as you master Windows features, the Windows Runtime, and the best practices of app design. Along the way, you'll pick up tips for deploying apps, including selling through the Windows Store. This book requires some knowledge of C#. No experience with Windows 8 is needed. What's Inside Designing, creating, and selling Windows Store apps Developing touch and sensor-centric apps Working C# examples, from feature-level techniques to complete app design Making apps that talk to each other Mixing in C++ for even more features About the Author Pete Brown is a Developer Evangelist at Microsoft and author of Silverlight 4 in Action and Silverlight 5 in Action. Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications. Table of Contents Hello, Modern Windows The Modern UI The Windows Runtime and .NET XAML Layout Panels Brushes, graphics, styles, and resources Displaying beautiful text Controls, binding, and MVVM View controls, Semantic Zoom, and navigation The app bar The splash screen, app tile, and notifications View states Contracts: playing nicely with others Working with files Asynchronous everywhere Networking with SOAP and RESTful services A chat app using sockets A little UI work: user controls and Blend Networking player location Keyboards, mice, touch, accelerometers, and gamepads App settings and suspend/resume Deploying and selling your app
Author(s): Pete Brown
Publisher: Manning Publications
Year: 2013
Language: English
Pages: 624
WSAD
brief contents
contents
preface
acknowledgments
about this book
Audience
The bits: what you need
Roadmap
Code conventions and downloads
Author Online
about the author
about the cover illustration
1 Hello, Modern Windows
1.1 Setting up the development environment
1.2 Configuring the project
1.2.1 The device pane
1.2.2 Template solution items
1.3 Create the first Hello World UI
1.4 Integrating with Twitter
1.4.1 The Tweet class
1.4.2 Updated UI
1.4.3 Code-behind
1.5 Testing on different devices and resolutions
1.5.1 Debugging on the Simulator
1.5.2 Debugging on a remote device
1.6 Summary
2 The Modern UI
2.1 Design inspiration
2.1.1 Direct influences
2.1.2 Finding your way
2.2 Governing principles
2.3 Typography
2.4 The importance of the layout grid
2.5 Design for touch but not only for touch
2.6 Modern apps on Windows 8
2.6.1 Consumer and enterprise apps
2.6.2 Key Windows 8 UI elements and states
2.7 Device considerations
2.7.1 Desktop or laptop
2.7.2 Tablet and smaller devices
2.7.3 Hybrid devices
2.8 Summary
3 The Windows Runtime and .NET
3.1 Windows Store app system architecture
3.1.1 The sandbox
3.1.2 Deployment and the Windows Store
3.1.3 The driver model
3.2 COM + .NET metadata = WinRT
3.2.1 COM: back to the future
3.2.2 Metadata
3.2.3 Projections
3.3 Client technologies and languages
3.4 A brief tour of WinRT and .NET 4.5
3.5 Summary
4 XAML
4.1 Elements and namespaces
4.1.1 Objects as elements
4.1.2 Namespaces
4.2 Properties
4.2.1 Property syntax
4.2.2 Dependency properties
4.2.3 Attached properties
4.2.4 Property paths
4.3 Object trees and namescope
4.3.1 Object trees
4.3.2 Namescope
4.4 Summary
5 Layout
5.1 Multipass layout—measuring and arranging
5.1.1 The measure pass
5.1.2 The arrange pass
5.1.3 The LayoutInformation class
5.2 UIElement layout properties
5.2.1 Width and Height, plus ActualWidth and ActualHeight
5.2.2 Horizontal and vertical alignment
5.2.3 Padding
5.2.4 Margins
5.3 Layout rounding
5.4 Performance considerations
5.4.1 Keeping the tree shallow
5.4.2 Caching
5.4.3 Virtualization
5.4.4 Sizing and positioning
5.5 Summary
6 Panels
6.1 Canvas
6.1.1 Positioning in X,Y space
6.1.2 Controlling the Z position using ZIndex
6.1.3 Sizing child elements
6.2 StackPanel and VirtualizingStackPanel
6.2.1 Setting the orientation
6.2.2 Sizing children
6.2.3 Virtualizing for performance
6.3 Grid
6.3.1 Defining rows and columns
6.3.2 Adding and positioning elements in rows and columns
6.3.3 Using alignment and margins for sizing and positioning
6.4 Creating a custom panel
6.4.1 Project setup
6.4.2 The OrbitPanel class
6.4.3 Orbits dependency property
6.4.4 Orbit attached property
6.4.5 Custom layout
6.5 Summary
7 Brushes, graphics, styles, and resources
7.1 Brushes
7.1.1 Solid-color brushes
7.1.2 Gradient brushes
7.1.3 Image brushes
7.2 Resources
7.2.1 Local and page resources
7.2.2 Application resources
7.2.3 Resource dictionaries
7.3 Styles
7.3.1 Explicit or keyed styles
7.3.2 Style inheritance
7.3.3 Implicit styles
7.4 Vector graphics
7.4.1 Line
7.4.2 Polyline
7.4.3 Paths
7.4.4 Rectangles and ellipses
7.5 Bitmap images
7.6 Summary
8 Displaying beautiful text
8.1 Text basics
8.1.1 TextBlock
8.1.2 Inlines
8.1.3 Wrapping, ellipsis, and alignment
8.1.4 Character spacing
8.1.5 Line spacing
8.2 Rich and multicolumn text
8.2.1 Rich text
8.2.2 Multicolumn and linked text
8.3 OpenType text
8.3.1 Ligatures
8.3.2 Stylistic sets
8.3.3 Font capitals
8.3.4 Fractions and numbers
8.3.5 Variants, superscript, and subscript
8.4 Embedding fonts
8.5 Summary
9 Controls, binding, and MVVM
9.1 The Model-View-ViewModel pattern
9.1.1 Using an MVVM toolkit like MVVM Light
9.1.2 The model
9.1.3 The chat data service
9.1.4 The MainViewModel and CameraViewModel classes
9.1.5 The view
9.2 Binding primer
9.2.1 The source and target
9.2.2 Binding mode
9.2.3 Change notification
9.2.4 DataContext
9.3 Entering and displaying text
9.3.1 Working with the TextBox
9.3.2 Experimenting with the PasswordBox
9.3.3 Spell checking and autocorrect
9.4 UI element binding using sliders
9.5 Working with lists
9.5.1 Observable collections
9.5.2 Items controls
9.5.3 Data templates
9.6 Making things happen with buttons and commands
9.6.1 Button and commands
9.6.2 HyperlinkButton
9.6.3 RadioButton and CheckBox
9.7 Converting data with value converters
9.8 Summary
10 View controls, Semantic Zoom, and navigation
10.1 PhotoBrowser demonstration app setup
10.1.1 Creating the project
10.1.2 Creating the Photo model class
10.1.3 Loading pictures using a service class
10.1.4 Creating the MainViewModel
10.1.5 Skeleton UI XAML and code-behind
10.2 ListView and GridView
10.2.1 Vertical lists
10.2.2 Horizontal lists and grids
10.3 Grouping with the GridView
10.3.1 Grouping in the model and viewmodel
10.3.2 Grouping at the UI layer
10.4 FlipView and navigation
10.4.1 Viewmodel
10.4.2 Category browser page
10.4.3 Updated MainPage
10.5 Semantic Zoom
10.6 Summary
11 The app bar
11.1 Project updates
11.2 Controls on the bottom app bar
11.2.1 Adding and styling buttons
11.2.2 Wiring with commands
11.2.3 Visibility and pinning
11.3 Top app bar for navigation
11.4 App bar popups and menus
11.5 Summary
12 The splash screen, app tile, and notifications
12.1 Splash screens
12.1.1 The static splash screen
12.1.2 Extended splash screens
12.2 Default tiles on the start page
12.3 Secondary or pinned tiles
12.3.1 Creating the tile
12.3.2 Activating the app with the secondary tile
12.4 Tile notifications or live tiles
12.4.1 Simple text notifications
12.4.2 Images in notifications
12.4.3 Queuing multiple tile notifications
12.5 Toast notifications
12.5.1 Creating the notification service
12.5.2 Enabling toast
12.6 Summary
13 View states
13.1 Full, filled, and snapped views
13.2 The LayoutAwarePage
13.3 The snapped view for the main page
13.4 Visual states for view management
13.5 Detail pages and app bars
13.5.1 Creating an appropriate presentation
13.5.2 Fixing up the app bar
13.6 Summary
14 Contracts: playing nicely with others
14.1 Sharing
14.1.1 Sharing your data
14.1.2 Letting others share with you
14.2 Letting others search your data
14.2.1 Declaring your intentions
14.2.2 The results page and viewmodel
14.2.3 Responding to in-app search requests
14.2.4 Responding to external search requests
14.3 Summary
15 Working with files
15.1 Loading files programmatically
15.1.1 New demonstration project
15.1.2 File access permissions
15.1.3 Storage files and folders
15.1.4 Using a data template selector
15.1.5 Using file queries
15.1.6 Creating files and folders
15.2 URI formats
15.3 Working with file pickers
15.3.1 Using the file open picker
15.3.2 Implementing the file picker source contract
15.4 Summary
16 Asynchronous everywhere
16.1 Why asynchronous is important
16.2 Working with IAsync* WinRT methods
16.2.1 async and await: the simplest approach
16.2.2 Long-form asynchronous operations
16.2.3 Getting progress updates
16.2.4 Canceling the operation
16.3 Working with tasks
16.3.1 Basic task operations
16.3.2 Canceling the task
16.3.3 Converting between WinRT IAsync* and Tasks
16.4 Summary
17 Networking with SOAP and RESTful services
17.1 Networking basics
17.1.1 Solution setup
17.1.2 Downloading a file with HttpClient
17.2 Sharing your model
17.2.1 Create the source class library
17.2.2 Create the Modern app–compatible class library
17.3 Consuming SOAP services
17.3.1 Creating the service
17.3.2 Referencing and using the service
17.4 Structuring your client code using MVVM
17.4.1 Creating the viewmodel
17.4.2 Creating and wiring up the user interface
17.5 Consuming data from RESTful services
17.5.1 Creating the RESTful service
17.5.2 Getting data from the service using the viewmodel
17.5.3 Specifying the acceptable data type
17.6 Deserializing JSON and XML data
17.6.1 XML deserialization using XmlSerializer
17.6.2 JSON deserialization
17.7 Updating data using PUT, POST, DELETE, and more
17.8 Summary
18 A chat app using sockets
18.1 Chat app viewmodel
18.1.1 The MainViewModel class
18.1.2 ChatMessage model class
18.2 The user interface
18.2.1 XAML skeleton
18.2.2 Styles and resources
18.2.3 App bar buttons
18.2.4 Chat app content
18.3 Listening for connections
18.4 Connecting to the server and sending data
18.4.1 Connecting to an endpoint
18.4.2 Sending data
18.5 Refactoring for better structure and flexibility
18.5.1 The updated ChatMessage class
18.5.2 The IMessageService interface
18.5.3 The TcpStreamMessageService class
18.5.4 Updated MainViewModel
18.6 Trying out UDP sockets
18.6.1 Creating the UdpMessageService class
18.6.2 Listening for connections
18.6.3 Connecting to another machine
18.6.4 Receiving and parsing messages
18.7 Summary
19 A little UI work: user controls and Blend
19.1 Updated game UI
19.1.1 Basic changes
19.1.2 Play field area
19.1.3 Orientation and view states
19.2 Designing the ship UI
19.2.1 Creating the UserControl
19.2.2 Creating the ship shape in Blend
19.2.3 Adding a label
19.3 Building out the ship user control properties
19.3.1 Enabling rotation
19.3.2 Setting the color
19.3.3 Temporarily testing the Ship control
19.4 Summary
20 Networking player location
20.1 Updating the Player model
20.1.1 The PlayerLocation class
20.1.2 The updated Player class
20.2 The collection of players
20.2.1 Initializing the collection
20.2.2 Displaying players with an ItemsControl
20.2.3 Testing the collection
20.2.4 Wiring up the collection to service events
20.3 Updating the TCP stream message service
20.3.1 Updated message service interface
20.3.2 Sending location information
20.3.3 Reading location information
20.4 Testing everything
20.5 Summary
21 Keyboards, mice, touch, accelerometers, and gamepads
21.1 Making input generic
21.1.1 The IInputService interface
21.1.2 A little math help
21.1.3 Wiring up the viewmodel
21.2 Keyboard input
21.2.1 The KeyboardInputService
21.2.2 Virtual keys
21.2.3 Adding from the code-behind
21.3 Pointer input: mouse, touch, and pen
21.3.1 Some more math
21.3.2 A minor modification to the ship user control
21.3.3 The PointerInputService class
21.3.4 Adding from the code-behind
21.4 Accelerometer input
21.4.1 Making sense of the input
21.4.2 Implementing the AccelerometerInputService
21.4.3 Adding from the code-behind
21.4.4 Accelerometer events
21.4.5 Dealing with screen autorotation
21.5 Xbox 360 gamepad input and a little C++
21.5.1 Creating the C++ project
21.5.2 Implementing the Controller class
21.5.3 Creating the IInputService wrapper
21.5.4 Adding from the code-behind
21.5.5 Compiling and deploying
21.6 Summary
22 App settings and suspend/resume
22.1 App settings UI and architecture
22.1.1 Creating the settings infrastructure
22.1.2 Creating a settings UI
22.2 Persisting and using settings
22.2.1 Loading and saving settings values
22.2.2 Acting on the options
22.3 Suspend and resume
22.3.1 Suspending your app
22.3.2 Resuming activity
22.4 Summary
23 Deploying and selling your app
23.1 Testing for certification
23.2 Sideloading for testing purposes
23.2.1 Packaging an app for sideloading
23.2.2 Getting a developer license without Visual Studio
23.2.3 Installing the sideload app package
23.3 Enabling trial mode
23.3.1 Creating the mock license data for testing
23.3.2 Checking the license state
23.4 Listing your app in the Windows Store
23.4.1 Getting a Windows Store account
23.4.2 Reserving an app name
23.4.3 Submitting the app for review and approval
23.5 Summary
index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
WSAD-back