Tải bản đầy đủ

Microsoft silverlight 5 building rich enterprise dashboards

www.it-ebooks.info


Microsoft Silverlight 5: Building
Rich Enterprise Dashboards

Create, customize, and design rich enterprise
dashboards with Microsoft Silverlight 5

Todd Snyder,
Joel Eden, Ph.D.
Jeff Smith,
Matthew Duffield

professional expertise distilled

P U B L I S H I N G
BIRMINGHAM - MUMBAI

www.it-ebooks.info



Microsoft Silverlight 5: Building Rich
Enterprise Dashboards
Copyright © 2012 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the authors, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: January 2012

Production Reference: 1170112

Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84968-234-3
www.packtpub.com

Cover Image by Sandeep Babu (sandyjb@gmail.com)

www.it-ebooks.info


Credits
Authors

Technical Editor

Todd Snyder



Joyslita D'Souza

Joel Eden, Ph.D.

Sonali Tharwani

Jeff Smith

Indexer

Matthew Duffield

Tejal Daruwale
Project Coordinator

Reviewers

Leena Purkait

Curtis Taylor
Michael Crump

Proofreader

Siddharth Mehta

Clyde Jenkins

Peter Meany
Graphics

Acquisition Editor

Manu Joseph

Kerry George

Production Coordinator
Lead Technical Editor

Nilesh Mohite

Alina Lewis
Cover Work
Nilesh Mohite

www.it-ebooks.info


About the Authors
Todd Snyder has been a Software Developer/Architect for over 17 years. During

that time, he has spent several years as a Consultant, providing technical guidance
and leadership for the development of Enterprise Class Systems on the Microsoft
Platform. At Infragistics, he is a principal consultant who focuses on the design and
construction of RIA and N-tier based applications. Todd is the co-leader for the New
Jersey .NET user group (http://www.njdotnet.net/) and is a frequent speaker at
trade shows, code camps, and Firestarters.

Joel Eden, Ph.D. has been working in the area of user experience and design
methods for over 10 years. Currently a Senior Interaction Designer working on
UX Tools at Infragistics, he previously spent 3 years in the Infragistics UX Services
group, consulting for external clients. Prior to Infragistics, he worked at multiple
design agencies in the Philadelphia area, as well as working at Lockheed Martin's
Advanced Technology Labs. He holds a B.S. in Computer Science, and a PhD in
Information Science, both from Drexel University.
I would like to thank my wife Kathleen and my daughters Abigail
and Genevieve, for giving me reasons to design a better future.

www.it-ebooks.info


Jeff Smith has been a Visual Designer for 6 years. During that time he has been an
Art Director at various agencies and studied Special Effects and Animation at NYU.
A convert from Flash and Flex, he has been working with .NET technologies for the
past 2 years, specializing in WPF and Silverlight. At Infragistics, he is an UX Visual
Designer who focuses on the design, implementation, and User Experience. You can
view some of his work at http://www.thinksinkstudio.com.
I would like to thank my friends, family, girlfriend, and colleagues
for providing support and inspiration.

Matt Duffield is the Architect at emGovPower, a leading software provider for

managing city and county governments. With over 15 years of working in IT, he
enjoys building rich user-centric applications. Matt is very active in the community,
speaking at user groups and code camps. He is an INETA speaker member and has
been a Microsoft MVP in Client Application Development. He started working in
.NET as soon as it was available to the development community and was also an
early adopter of both WPF and Silverlight. He believes good business intelligence
(BI) architecture is the formula for a successful software package that looks beyond
just data and provides insightful information. His blog can be found at http://
mattduffield.wordpress.com. You can follow him on Twitter at @mattduffield.
Matt currently lives in Charlotte, North Carolina with his wife and two sons.
First of all, I would like to thank my family and colleagues who
have been instrumental in helping me work on this book. It is their
encouragement and enthusiasm that has in turn been my drive
for writing. I have always loved working in Silverlight, and I look
forward to many more years doing the same. I would also like to
thank the team at Packt Publishing for allowing me to become a part
of this book and having the patience and wisdom to help me during
the writing process. It has been a wonderful experience, and I look
forward to doing it again in the future.

www.it-ebooks.info


About the Reviewers
Curtis Taylor is a Principal Consultant at Infragistics, Inc. When he first started

studying human interaction with products, objects and particularly software
interfaces, he noticed people often believed they were dumb when they did not
understand an interface. However, rather than fixing the problem, the industry
standardized interfaces which lacked the ability to engage most users. The
industry attempted to fix the user, rather than the interfaces. Designing interface
is an interaction between user and developer. Two things drew him to Software
Development—the abstraction of writing code and the challenge of presenting that
abstraction to human beings in a way they can understand.
People are organic. Computers are not. So the work of making software interfaces
more understandable, practical, and enjoyable became something he wanted to
do. Software development is his connection to serving people. People are more
important than things. Perhaps his message will be communicated in the interfaces
he creates, the code he writes, and the feedback, training, and team-work he offers to
other developers.
He loves WPF and Silverlight! So much so, Infragistics found and hired him to be a
consultant and trainer. At Infragistics he works directly with customers helping them
solve technical and UI-related issues with WPF and Silverlight, he provides training
as a fellow software engineer, and he develops custom solutions for customers who
wish to utilize their services a step beyond the capabilities of their products.

Michael Crump is an MCPD who has been involved with computers in one way

or another for as long as he can remember, but started professionally in 2002. After
spending years working as a System Administrator/Tech Support Analyst, Michael
branched out and started developing internal utilities that automated repetitive
tasks and freed up full-time employees. From there, he was offered a job working at
McKesson corporation and has been working with some form of .NET and VB/C#
since 2003.

www.it-ebooks.info


Michael is currently serving as a Subject Matter Expert (SME) and Content Editor on
several other Silverlight publications. He resides in Birmingham, AL with his wife
Amanda and children Ridley and Adrienne.
He shares his findings in his personal blog: http://michaelcrump.net, and he also
tweets at @mbcrump.

Siddharth Mehta is a Business Intelligence professional with more than
nine years of experience, and presently works in the role of a Technology
Architect for Accenture Services Pvt. Ltd (Mumbai, India), in the capacity of
an Associate Manager. Prior to Accenture, he has worked at Capgemini with
clients including Walt Disney Pictures and Television, CitiBank, Transport for
London, and ABN AMRO.
He started his career in 2002 with Visual Basic and SQL Server, and since then he has
been majorly working with SQL Server, Business Intelligence, Data Warehousing,
Dimensional Modeling, Information visualization design, and related technologies.
He is known for his writing in the field of Microsoft Business Intelligence. He has
authored a whitepaper for MSDN Library, titled Bulk Report generation using SSIS and
SSRS 2008 R2. He continues authoring content on MS BI for community sites such as
MSSQLTips.com, SQLServerCentral.com, SQL-Server-Performance.com, and others.
He has been the Technical Reviewer of the book Microsoft SQL Azure Enterprise
Application Development.
He has won awards such as Microsoft Most Valuable Professional CY'11, Capgemini
India Envoy FY'10, and others through the course of his career. He shares his insights
on business intelligence through his blog: http://siddhumehta.blogspot.com. He
can be reached at siddhumehta_brain@yahoo.co.in.
Through thick and thin, all I am today is the result of my parent's
(Divya Mehta and Kaushik Mehta) vision and my brother's (Rahul
Mehta) support to solve troubles before it reaches me. I am grateful
to them for taking care of my responsibilities while I remained busy
reviewing this book.

www.it-ebooks.info


www.PacktPub.com
Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related
to your book.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can access, read and search across Packt's entire library of books.

Why Subscribe?




Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser

Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view nine entirely free books. Simply use your login credentials
for immediate access.
Instant Updates on New Packt Books
Get notified! Find out when new books are published by following @PacktEnterprise
on Twitter, or the Packt Enterprise Facebook page.

www.it-ebooks.info


Table of Contents
Preface
Chapter 1: The Silverlight Technology
What benefit does Silverlight bring to the table?
XAML as a declarative programming model
Model-View-ViewModel (MVVM)
View First versus ViewModel First

Dependency Injection (DI)
Silverlight as a Web technology
Asynchronous programming in Silverlight
Silverlight features
Client-side application development
Reduced server load
Client-side state
Cross-browser development simplified
Putting the pieces together
Summary

Chapter 2: Overview of Dashboards and Silverlight
What are dashboards
Purpose of dashboards
Problems dashboards solve
Current state of building dashboards
When good just isn't good enough
Why should we use Silverlight?
Summary

Chapter 3: Silverlight Design and Development Tools
Blend strengths and weaknesses
Visual Studio strengths and weaknesses
Visual States

www.it-ebooks.info

1
5
5
6
6
9

11
14
16
16
21
21
22
23
23
24

25
26
32
35
36
37
38
41

43
44
46
48


Table of Contents

Storyboards
Sample Data
Templates
Visual Studio
Debugging
Developing for Silverlight
Project Management
Summary

51
52
55
59
60
63
64
66

Chapter 4: Building a Basic Dashboard

67

Chapter 5: Dashboard Types and User Needs

87

Creating a Silverlight Dashboard Application
What is the MVVM pattern
Building the Dashboard
Setting up the Data Source
Defining the View-Model and Model classes
Laying out XAML and Data Binding
Customizing the UI
Summary

67
70
73
74
75
78
83
85

Different dashboards for different needs
88
Strategic
88
Analytical
89
Operational
89
The Good, the Bad, and the Ugly—typical dashboard charts and graphs89
Bar chart
90
Pros
Cons

90
91

Stacked bar chart

91

Pros
Cons

91
91

Line graph

91

Pros
Cons

92
92

Scatterplot

92

Pros
Cons

92
92

Bullet graph

93

Pros
Cons

93
93

Sparkline

94

Pros
Cons

94
94

Small multiples

94
[ ii ]

www.it-ebooks.info


Table of Contents
Pros
Cons

95
95

Pie chart

95

Pros
Cons

95
96

Focusing on needs, not technology
Representing and communicating user experience
User-centered design
User research
Personas
Scenarios
Requirements
Storyboards
Sketches
Wireframes
Prototypes
High-fidelity mockups

Scenario-based requirements and design
Example scenarios for dashboard design
Summary

Chapter 6: Designing for Insight

Interaction aesthetics versus visual aesthetics
Pre-attentive processing
Applying pre-attentive processing to dashboard design
Warnings about using pre-attentive attributes

Scenario-based design of our dashboard
Our initial overall dashboard wireframe
Requirement 1
Requirement 2
Requirement 3
Requirement 4
Requirement 5
Requirement 6

96
97
99
99
100
100
100
101
101
101
101
102

102
105
107

109

109
111
111
113

114
115
116
117
119
120
121
122

Summary

125

Chapter 7: Designing your Dashboard
Knowing your tools
Blend basics

Assets
Data
Design View (Artboard)
Objects and Timeline
Parts
Projects
Properties
Resources

127
128
128

129
130
130
131
132
132
132
134
[ iii ]

www.it-ebooks.info


Table of Contents
Results
States

134
135

Styling in Silverlight
Referencing resources
Implementing resources

135
136
136

Creating a Button
Exploring a Button's Control Template
Adding Visual States (Visual State Manager)
Converting Brushes to Resources
Creating Resource Dictionaries

Getting started with styling our Dashboard
Creating a custom User Control in Blend
Styling the Grid and Chart
Summary

Chapter 8: Building an End-to-End Solution
Dashboard prerequisites
Dashboard requirements
Designing the solution
Describing an N-Tier application design
Sample project structure
Setting up the Data Source
Reviewing the database schema
Stored procedures
spTopUsInternetProducts
spTopUsInternetCustomers
spSalesByRegion
spFinanceData

136
137
144
152
155

157
157
160
162

163
164
164
166
166
168
172
173
174
175
176
177
178

Building the server components
Domain Model (Shared Between Client
and Server)
Data Access Layer
Building the WCF service
Defining the presentation layer
View and controls
View Model
Service Layer
Summary

Chapter 9: Data Access Strategies
Data access overview
Core networking classes
Working with WebClient
Using Fiddler

180
180
187
194
197
197
205
209
212

213
214
214
214
218

[ iv ]

www.it-ebooks.info


Table of Contents

Understanding network security
Building services with Windows Communication Foundation
Working with WCF
The data access layer

219
221
223
224

Building a SOAP service
Building a REST service
Exploring OData data services
Building an OData service
Consuming an external service
Summary

Chapter 10: Building Dashboards in SharePoint and Silverlight
Overview of SharePoint
Setting up SharePoint
Building a Silverlight web part
Using the Client Object Model
Building a SharePoint Silverlight dashboard
Setting up our data source
Building our dashboard
SharePoint Data Access Strategies
Summary

Index

227
230
233
235
238
240

241
241
242
244
248
252
252
253
259
259

261

[v]

www.it-ebooks.info


www.it-ebooks.info


Preface
Welcome, to the exciting world of building Rich Enterprise Dashboards with
Silverlight. Throughout this book, you will learn how to harness the power of the
Silverlight 5.0 platform to build amazing Dashboards. This book goes beyond just
showing the nuts and bolts of learning Silverlight and showcases how to create
amazing dashboards that offer the best user experience and visual design that will
impress your end users and peers.

What this book covers
Chapter 1, The Silverlight Technology, is an overview of the Silverlight 5.0 Platform and
teaches you how to build Silverlight applications.
Chapter 2, Overview of Dashboards and Silverlight, answers why you should use
Silverlight 5.0 to build dashboards and compares the use of Silverlight and HTML
for building dashboards.
Chapter 3, Silverlight Design and Development Tools, is an overview of the different
tools you will need to build a dashboard applications.
Chapter 4, Building a Basic Dashboard, is a walkthrough of how to build a simple
Silverlight dashboard application.
Chapter 5, Dashboard Types and User Needs, outlines the three main types of
dashboards: Strategic, Operational, and Analytical. By the end of this chapter, you
will understand how to choose the right dashboard for your project depending upon
your needs.
Chapter 6, Designing for Insight, throws light on designing concepts of bringing the
end-user's attention to certain information. Using these concepts, we will design a
dashboard that supports the scenario we have already created.

www.it-ebooks.info


Preface

Chapter 7, Designing your Dashboard, covers the basics of styling a Silverlight
dashboard with Microsoft Expression Blend. Through this chapter you will
understand the key styling terminology, learn how to reference resources, and edit
basic control templates.
Chapter 8, Building an End-to-End Solution, is an overview of building a real-world
Silverlight dashboard application that uses the Microsoft SQL Server Adventure
Works sample database. Through this chapter you will explore how to use the
N-Tier application model to build out the AdventureWorks dashboard application.
Chapter 9, Data Access Strategies, outlines the different data access strategies and
technologies you can use when building your Silverlight dashboard application.
Chapter 10, Building Dashboards in SharePoint and Silverlight, covers how to build
a SharePoint web part for hosting a Silverlight dashboard, and how to use the
SharePoint Client Object Model to access data hosted in SharePoint.

What you need for this book
To build the samples in this book, you will need to have the following available:







Visual Studio 2010 Express or Professional Edition
SQL Server 2008 R2 Express or Developer Edition
Silverlight 5.0 SDK
Silverlight 5.0 Toolkit
Microsoft Expression Blend 4.0 (with Updates for Silverlight 5.0)
Share Point 2010 Foundations (Optional only required for Chapter 10, Building
Dashboards in SharePoint and Silverlight)

Who this book is for
If you are a .NET developer who wants to create, customize, and design rich
enterprise dashboards with Silverlight, then this book is for you. You should have
an intermediate understanding of .NET development, with a working knowledge of
Microsoft Silverlight.

Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
[2]

www.it-ebooks.info


Preface

Code words in text are shown as follows: "We can include other contexts through the
use of the include directive."
A block of code is set as follows:

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×
x