Book Image

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide

By : Johnny Tordgeman
Book Image

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide

By: Johnny Tordgeman

Overview of this book

Microsoft Silverlight is a powerful development platform for creating engaging, interactive applications for many screens across the Web, desktop, and mobile devices. Silverlight is also a great (and growing) Line-Of-Business platform and is increasingly being used to build data-driven business applications. Silverlight is based on familiar .NET languages such as C# which enables existing .NET developers to get started developing rich internet applications almost immediately. "MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide" will show you how to prepare for and pass the (70-506): TS: Microsoft Silverlight 4 Development exam.Packed with practical examples and Q&As, MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide starts by showing you how to lay out a user interface, enhance the user interface, implement application logic, work with data and interact with a host platform amongst others.
Table of Contents (15 chapters)
MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Working with background threads


Threading is a well-known feature to push time consuming tasks to a separate thread. Silverlight, by default, is running our code in the UI thread, which means that if we have a method that takes time to finish, the UI thread will be blocked and won't allow interaction until the method finishes running. By pushing this time consuming method to a different thread, the method will still take time to complete, but the UI thread won't be blocked, and the user can keep interacting with it while the method computes.

While Silverlight doesn't offer all of the threading options that the full .NET framework offers, it's still powerful enough to drive multithreaded applications. One important aspect you have to remember when working with threads is that your code runs in a whole other environment than your UI, and as such you cannot access any of the elements in the UI thread. Don't fear though; a workaround for this will be shown shortly.

Spawning a background thread...