Matt Baxter-Reynolds and Iris Classon
Programming Windows Store
Apps with C#
Programming Windows Store Apps with C#
by Matt Baxter-Reynolds and Iris Classon
Copyright © 2014 Matt Baxter-Reynolds. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editors: Maria Stallone and Rachel Roumeliotis
Production Editor: Melanie Yarbrough
Copyeditor: Rachel Monaghan
Proofreader: Charles Roumeliotis
Indexer: Judith McConville
Cover Designer: Randy Comer
Interior Designer: David Futato
Illustrator: Rebecca Demarest
February 2014:
First Edition
Revision History for the First Edition:
2014-02-10: First release
See http://oreilly.com/catalog/errata.csp?isbn=9781449320850 for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Programming Windows Store Apps with C#, the image of a pika, and related trade dress are
trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-32085-0
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1.
Making the Transition from .NET (Part 1). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Why WinRT? 1
Philosophical Differences 2
Objectives 3
The New Project Templates 3
WinRT Metadata 4
Project Settings and Adding References 9
Building a Basic User Interface 11
UI Tracks 11
XAML Parsing Basics 14
Building a Basic Page 15
Implementing MVVM 25
WPF and Silverlight 26
MVVM Structure and Inversion of Control 28
Creating the View-Model and Running the App 38
2.
Making the Transition from .NET (Part 2). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Inversion of Control 47
Installing TinyIoC 48
Initializing IoC Defaults 49
Understanding Asynchrony 53
How Asynchrony Works in WinRT 55
Calling the Server 60
Building the Service Proxies 60
Building the Register Method 63
Finishing the UI to Call the Register Server Function 67
Logon 68
iii