Silverlight Development &  The Model-View-ViewModel Pattern Derek Novavi 25 November 2009
Silverlight & Model-View-ViewModel <ul><li>Overview of Silverlight </li></ul><ul><li>Silverlight 3 Features </li></ul><ul>...
Overview of Silverlight
What is Silverlight? <ul><li>Web application framework that supports line-of-business applications. </li></ul><ul><li>Comp...
What is Silverlight? <ul><li>Runs as a browser plug-in, in much the same way as Adobe Flash. </li></ul>
Silverlight Versions <ul><li>Silverlight 1 - used a JavaScript programming model – no .NET or BCL. </li></ul><ul><li>Silve...
Silverlight 3 Features
XAML <ul><li>XAML elements are objects that map to classes in the Silverlight runtime. </li></ul><ul><li>Therefore declari...
.NET Framework Support – CoreCLR <ul><li>CoreCLR still responsible for managing memory and enforcing CTS. </li></ul><ul><l...
Graphics and Animations <ul><li>Support for raster graphics and vector graphics. </li></ul><ul><li>Local font usage for re...
Page Layout and Design <ul><li>Canvas  – absolute positioning. </li></ul><ul><li>Grid  – similar to an HTML table. </li></...
Page Layout Example – DockPanel
Isolated Storage – Overview <ul><li>A client-side cache location to store and access commonly-needed data locally. </li></...
Isolated Storage – Configuration
Isolated Storage – Increasing Space <ul><li>When an application requires additional storage space, it will prompt the user...
Isolated Storage – Key/Value Pairs <ul><li>Data can be saved and retrieved using key/values pairs. </li></ul><ul><li>Isola...
Isolated Storage – Files <ul><li>Data can be saved or retrieved in a virtual file system. </li></ul><ul><li>IsolatedStorag...
Isolated Storage – Location <ul><li>The physical location of the files depends on the OS and whether or not roaming user p...
Isolated Storage – Root Locations <ul><li>On Windows XP </li></ul><ul><li>Roaming-enabled stores:  </li></ul><ul><li><SYST...
Isolated Storage – Physical Files
Out-of-Browser Applications <ul><li>End-user can save application to their desktop.  Application stored locally in a low t...
Out-of-Browser Applications <ul><li>Installed / removed using context menu. </li></ul>
Accessing Network Resources <ul><li>Supports  WebClient  class for basic HTTP or HTTPS access to URI-based resources e.g. ...
<ul><li>Navigation Framework </li></ul><ul><li>Silverlight 3 introduced new  Frame  and  Page  controls to support navigat...
Data Binding – Overview <ul><li>Supports data-bound controls, XAML markup extensions, data context binding and Value Conve...
Data Binding – Modes <ul><li>OneTime  – updates the target property when the binding is created. </li></ul><ul><li>OneWay ...
HTML Bridge <ul><li>Allows access to the HTML DOM from managed code in Silverlight. </li></ul><ul><li>Allows one to call m...
Silverlight Development
Building Silverlight Applications <ul><li>Visual Studio 2008, using the Silverlight project templates. </li></ul><ul><li>E...
VS2008 Silverlight 3 Project Templates <ul><li>[Above: Three Silverlight 3 templates, two .NET RIA Services templates] </l...
Example Project in Solution Explorer
Embedding the Silverlight Plug-in <ul><li>The plug-in can be embedded in an HTML page using an  object  element and child ...
Embedding – Example HTML <ul><li>Also supports  InitParams  property to pass initialization parameters. </li></ul>
Add Silverlight to Page Using JavaScript <ul><li>Using the  createObject  method of the Silverlight object in the  Silverl...
Example XAML Markup <ul><li>The  x:Class  attribute specifies the fully qualified name of a class. </li></ul><ul><li>XAML ...
Example Code-Behind <ul><li>Derives from  System.Windows.Controls.UserControl </li></ul>
Silverlight XAP File
What is a XAP File? <ul><li>XAP is the file extension for Silverlight application packages. </li></ul><ul><li>Contains com...
XAP Mime Type <ul><li>In IIS, we add the mime type for  .xap </li></ul><ul><li>application/x-silverlight-2 </li></ul>
Example XAP File <ul><li>The contents can be viewed using any standard .zip utility. </li></ul>
Contents of a XAP File <ul><li>An assembly for the application. </li></ul><ul><li>An application manifest file which defin...
App.xaml <ul><li>Used by Silverlight application to declare shared resources such as brushes, styles, etc. </li></ul><ul><...
App.xaml.cs Example <ul><li>Derives from  System.Windows.Application </li></ul>
Silverlight Lifecycle <ul><li>[Sourced from MSDN documentation] </li></ul>
Silverlight Lifecycle <ul><li>User requests page hosting the Silverlight plug-in. </li></ul><ul><li>Browser loads plug-in,...
Silverlight Toolkit
Silverlight Toolkit – Overview <ul><li>Developed by Microsoft. </li></ul><ul><li>Iterative, evolutionary model to release ...
Silverlight Toolkit – Controls <ul><li>AutoCompleteBox  </li></ul><ul><li>Calendar  </li></ul><ul><li>ChildWindow  </li></...
Silverlight Toolkit – TreeView Control
Silverlight Toolkit – DataGrid Control <ul><li>[Screenshot removed due to data content] </li></ul>
Silverlight Toolkit – DataGrid Control
Sample Silverlight Data Maintenance Application
Sample Application – Technologies Used <ul><li>Built using: </li></ul><ul><li>Visual Studio 2008 </li></ul><ul><li>Silverl...
Sample Application – UI <ul><li>[Screenshots removed due to data content] </li></ul>
Sample Application – Controls Used <ul><li>Demos the following Silverlight controls: </li></ul><ul><li>Grid, Image, TextBl...
Sample Application – Demo <ul><li>[Break out into Visual Studio for demo of application, and a detailed look at the code] ...
The Model-View-ViewModel Pattern
Model-View-ViewModel – Overview <ul><li>A design pattern that originated from Microsoft. </li></ul><ul><li>A specialisatio...
Model-View-ViewModel – Objectives <ul><li>Separation of concerns  – decoupling of presentation, business logic and data la...
Model-View-ViewModel – Description <ul><li>Model  – refers to the data access layer. </li></ul><ul><li>View  – refers to v...
Model-View-ViewModel in Silverlight <ul><li>Need the ability to for UI layer to bind directly to commands in the ViewModel...
Sample M-V-VM Silverlight App – UI <ul><li>[Screenshots removed due to data content] </li></ul>
M-V-VM Sample – Technologies Used <ul><li>As with first POC shown, built using: </li></ul><ul><li>Visual Studio 2008, Silv...
Sample M-V-VM Silverlight App – Demo <ul><li>[Break out into Visual Studio for demo of application, detailed look at the c...
Silverlight Unit Test Framework
Unit Testing in Silverlight <ul><li>VS Test projects cannot target the Silverlight &quot;CoreCLR&quot; Runtime as used by ...
Silverlight Unit Test Framework <ul><li>Unit tests run inside the browser. </li></ul><ul><li>Supports testing of Silverlig...
Silverlight Unit Test Framework <ul><li>[Sourced from SUT Framework website] </li></ul>
Silverlight Unit Testing <ul><li>See also Jamie Cansdale's Silverlight NUnit Project Template, which can be used with Test...
Third Party Products
Third Party Products <ul><li>In addition to: </li></ul><ul><li>Silverlight Toolkit on CodePlex </li></ul><ul><li>Silverlig...
Silverlight 4 Beta
Silverlight 4 – What’s New (selected) <ul><li>Support for .NET 4 CLR – same compiled code can run on desktop and Silverlig...
Silverlight 4 – What’s New (selected) <ul><li>MouseWheel support on many controls. </li></ul><ul><li>Data-binding improvem...
Summary
Summary <ul><li>Silverlight is a rapidly-maturing technology which is increasingly difficult for .NET developers to ignore...
Useful Links
Useful Links #1 <ul><li>The Official Microsoft Silverlight Site </li></ul><ul><li>http://www.silverlight.net/ </li></ul><u...
Useful Links #2 <ul><li>WCF RIA Services (formerly known as .NET RIA Services) </li></ul><ul><li>http://silverlight.net/ge...
Upcoming SlideShare
Loading in …5
×

Silverlight Development & The Model-View-ViewModel Pattern

7,208 views

Published on

Presentation covering some of the features of Silverlight 3, some background on developing Silverlight applications, the Model-View-ViewModel Pattern, the Silverlight Unit Test Framework, and some of the new features in Silverlight 4 Beta.

Published in: Technology
1 Comment
4 Likes
Statistics
Notes
  • its very nice
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
7,208
On SlideShare
0
From Embeds
0
Number of Embeds
44
Actions
Shares
0
Downloads
280
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide

Silverlight Development & The Model-View-ViewModel Pattern

  1. 1. Silverlight Development & The Model-View-ViewModel Pattern Derek Novavi 25 November 2009
  2. 2. Silverlight & Model-View-ViewModel <ul><li>Overview of Silverlight </li></ul><ul><li>Silverlight 3 Features </li></ul><ul><li>Silverlight 3 Development </li></ul><ul><li>Silverlight Toolkit </li></ul><ul><li>Sample Silverlight Application </li></ul><ul><li>The Model-View-ViewModel Pattern </li></ul><ul><li>Sample M-V-VM Silverlight Application </li></ul><ul><li>Silverlight Unit Test Framework </li></ul><ul><li>Third Party Products </li></ul><ul><li>Silverlight 4 Beta </li></ul>
  3. 3. Overview of Silverlight
  4. 4. What is Silverlight? <ul><li>Web application framework that supports line-of-business applications. </li></ul><ul><li>Competes with AJAX, Adobe Flex / AIR, Sun JavaFX, and emerging technologies HTML5, Google Gears. </li></ul><ul><li>Also provides functionality similar to those in Adobe Flash for graphics, animation and video. </li></ul><ul><li>Is available on multiple browsers used on Windows and Mac OS X. </li></ul>
  5. 5. What is Silverlight? <ul><li>Runs as a browser plug-in, in much the same way as Adobe Flash. </li></ul>
  6. 6. Silverlight Versions <ul><li>Silverlight 1 - used a JavaScript programming model – no .NET or BCL. </li></ul><ul><li>Silverlight 2 – supported .NET and BCL, with the familiar code-behind model. </li></ul><ul><li>Silverlight 3 – enhancements include navigation support for LOB applications, Out-of-Browser applications, richer data-binding, improved networking, graphics and media. </li></ul>
  7. 7. Silverlight 3 Features
  8. 8. XAML <ul><li>XAML elements are objects that map to classes in the Silverlight runtime. </li></ul><ul><li>Therefore declaring a XAML TextBlock like this: </li></ul><ul><li><TextBlock /> </li></ul><ul><li>actually creates a new instance of the TextBlock class like this: </li></ul><ul><li>TextBlock t = new TextBlock(); </li></ul>
  9. 9. .NET Framework Support – CoreCLR <ul><li>CoreCLR still responsible for managing memory and enforcing CTS. </li></ul><ul><li>JIT Compiler in CoreCLR is enhanced for fast startup time. </li></ul><ul><li>Just 2MB in size. </li></ul><ul><li>CoreCLR doesn’t need COM Interop or support for full-trust applications. </li></ul><ul><li>CoreCLR includes a subset of the BCL called “Small BCL”. </li></ul>
  10. 10. Graphics and Animations <ul><li>Support for raster graphics and vector graphics. </li></ul><ul><li>Local font usage for rendering text. </li></ul><ul><li>Animation – declarative and customizable via XAML. </li></ul><ul><li>Built-in support for video and audio – WMV, H.264, MP3, WMA, AAC. </li></ul>
  11. 11. Page Layout and Design <ul><li>Canvas – absolute positioning. </li></ul><ul><li>Grid – similar to an HTML table. </li></ul><ul><li>StackPanel – arranges elements in horizontal or vertical rows. </li></ul><ul><li>DockPanel – arranges elements around the edges of a panel. </li></ul><ul><li>WrapPanel – horizontal or vertical list, with wrapping. </li></ul>
  12. 12. Page Layout Example – DockPanel
  13. 13. Isolated Storage – Overview <ul><li>A client-side cache location to store and access commonly-needed data locally. </li></ul><ul><li>Persists data across sessions. </li></ul><ul><li>By default, web apps have 1MB of local storage. OOB apps have a 25MB quota. </li></ul><ul><li>Limit can be increased with user confirmation. </li></ul><ul><li>Cannot access end-user’s file system. </li></ul>
  14. 14. Isolated Storage – Configuration
  15. 15. Isolated Storage – Increasing Space <ul><li>When an application requires additional storage space, it will prompt the user for approval to user more space on the computer as follows: </li></ul>
  16. 16. Isolated Storage – Key/Value Pairs <ul><li>Data can be saved and retrieved using key/values pairs. </li></ul><ul><li>IsolatedStorageSettings class provides a dictionary to store objects. </li></ul><ul><li>Supports the familiar Add, Contains, Remove methods </li></ul><ul><li>Also supports the familiar Item property, as in: </li></ul><ul><li>userSettings[&quot;myKey&quot;] = myValue; </li></ul>
  17. 17. Isolated Storage – Files <ul><li>Data can be saved or retrieved in a virtual file system. </li></ul><ul><li>IsolatedStorageFile class represents an isolated storage area that can contain files and directories. </li></ul><ul><li>Supports methods such as FileExists, CreateFile, OpenFile, DeleteFile, DirectoryExists, CreateDirectory, DeleteDirectory . </li></ul>
  18. 18. Isolated Storage – Location <ul><li>The physical location of the files depends on the OS and whether or not roaming user profiles are used. </li></ul><ul><li>Data is always isolated by user and by assembly. </li></ul><ul><li>If curious, a developer could verify a change to isolated storage using the file system of the operating system. </li></ul>
  19. 19. Isolated Storage – Root Locations <ul><li>On Windows XP </li></ul><ul><li>Roaming-enabled stores: </li></ul><ul><li><SYSTEMDRIVE>Documents and Settings<user>Application Data </li></ul><ul><li>Non-roaming stores: </li></ul><ul><li><SYSTEMDRIVE>Documents and Settings<user>Local SettingsApplication Data </li></ul><ul><li>On Windows Vista </li></ul><ul><li>Roaming-enabled stores: </li></ul><ul><li><SYSTEMDRIVE>Users<user>AppDataRoaming </li></ul><ul><li>Non-roaming stores: </li></ul><ul><li><SYSTEMDRIVE>Users<user>AppDataLocal </li></ul>
  20. 20. Isolated Storage – Physical Files
  21. 21. Out-of-Browser Applications <ul><li>End-user can save application to their desktop. Application stored locally in a low trust location. Still run in a sandbox. </li></ul><ul><li>Launched from Start Menu or desktop shortcuts. Run without browser window. </li></ul><ul><li>Functionality built-in to Silverlight 3 – no special assemblies or controls required. </li></ul><ul><li>Enabled in application properties, which will modify the AppManifest.xml file. </li></ul>
  22. 22. Out-of-Browser Applications <ul><li>Installed / removed using context menu. </li></ul>
  23. 23. Accessing Network Resources <ul><li>Supports WebClient class for basic HTTP or HTTPS access to URI-based resources e.g. retrieving XML, JSON, RSS or Atom data formats, or downloading media to browser cache. </li></ul><ul><li>Supports HttpWebRequest and HttpWebResponse for more flexibility. </li></ul><ul><li>Support WCF and WCF RIA Services. Can use auto-generated proxy classes. </li></ul><ul><li>Supports sockets for &quot;push-style&quot; apps. </li></ul>
  24. 24. <ul><li>Navigation Framework </li></ul><ul><li>Silverlight 3 introduced new Frame and Page controls to support navigation. </li></ul><ul><li>Enables back-forward browser functionality via a hidden iframe . </li></ul><ul><li>Allows deep-linking, bookmarking, etc. </li></ul><ul><li>Supports URI mapping (descriptive URIs). </li></ul><ul><li>New &quot;Silverlight Navigation Application&quot; project template. </li></ul>
  25. 25. Data Binding – Overview <ul><li>Supports data-bound controls, XAML markup extensions, data context binding and Value Converters, </li></ul><ul><li>Setting the DataContext property on an element enables binding on child elements. </li></ul><ul><li>ItemsSource property used to bind to collections implementing IEnumerable . </li></ul><ul><li>Bindings can be set in XAML or in code. </li></ul>
  26. 26. Data Binding – Modes <ul><li>OneTime – updates the target property when the binding is created. </li></ul><ul><li>OneWay – updates the target property when the binding is created. Changes to the source object propagate to the target. </li></ul><ul><li>TwoWay – updates either the target or source object when either change. </li></ul>
  27. 27. HTML Bridge <ul><li>Allows access to the HTML DOM from managed code in Silverlight. </li></ul><ul><li>Allows one to call managed code in a Silverlight application from JavaScript. </li></ul><ul><li>Used to communicate between a Silverlight app and its hosting web page. </li></ul><ul><li>Attach SL event handlers to HTML controls. </li></ul><ul><li>Attach JS event handlers to SL controls. </li></ul>
  28. 28. Silverlight Development
  29. 29. Building Silverlight Applications <ul><li>Visual Studio 2008, using the Silverlight project templates. </li></ul><ul><li>Expression Blend. </li></ul><ul><li>Eclipse, using the Eclipse Tools for Silverlight plug-in – on either Windows or MacOS. (Version 2 of eclipse4sl will support Silverlight 3.) </li></ul>
  30. 30. VS2008 Silverlight 3 Project Templates <ul><li>[Above: Three Silverlight 3 templates, two .NET RIA Services templates] </li></ul>
  31. 31. Example Project in Solution Explorer
  32. 32. Embedding the Silverlight Plug-in <ul><li>The plug-in can be embedded in an HTML page using an object element and child param elements </li></ul>
  33. 33. Embedding – Example HTML <ul><li>Also supports InitParams property to pass initialization parameters. </li></ul>
  34. 34. Add Silverlight to Page Using JavaScript <ul><li>Using the createObject method of the Silverlight object in the Silverlight.js script </li></ul>
  35. 35. Example XAML Markup <ul><li>The x:Class attribute specifies the fully qualified name of a class. </li></ul><ul><li>XAML compilation joins partial classes between markup and code-behind. </li></ul><ul><li>Code partial class defined in a separate code file. </li></ul>
  36. 36. Example Code-Behind <ul><li>Derives from System.Windows.Controls.UserControl </li></ul>
  37. 37. Silverlight XAP File
  38. 38. What is a XAP File? <ul><li>XAP is the file extension for Silverlight application packages. </li></ul><ul><li>Contains compressed assemblies and resources of a Silverlight application. </li></ul><ul><li>Gets copied into ClientBin folder. </li></ul><ul><li>The Silverlight plug-in downloads and runs the XAP file. </li></ul>
  39. 39. XAP Mime Type <ul><li>In IIS, we add the mime type for .xap </li></ul><ul><li>application/x-silverlight-2 </li></ul>
  40. 40. Example XAP File <ul><li>The contents can be viewed using any standard .zip utility. </li></ul>
  41. 41. Contents of a XAP File <ul><li>An assembly for the application. </li></ul><ul><li>An application manifest file which defines the assemblies deployed in the client application ( AppManifest.xml ). </li></ul><ul><li>Any additional assemblies needed to run the application. </li></ul><ul><li>Can also contain embedded resources files such as graphics, audio, video. </li></ul><ul><li>If using WCF, might also contain ServiceReferences.ClientConfig </li></ul>
  42. 42. App.xaml <ul><li>Used by Silverlight application to declare shared resources such as brushes, styles, etc. </li></ul><ul><li>The code-behind file ( App.xaml.cs ) is used to handle global application-level events (similar to Global.asax.cs in ASP.NET applications). </li></ul>
  43. 43. App.xaml.cs Example <ul><li>Derives from System.Windows.Application </li></ul>
  44. 44. Silverlight Lifecycle <ul><li>[Sourced from MSDN documentation] </li></ul>
  45. 45. Silverlight Lifecycle <ul><li>User requests page hosting the Silverlight plug-in. </li></ul><ul><li>Browser loads plug-in, creates Silverlight content region, downloads .xap file. </li></ul><ul><li>Plug-in extracts .xap file contents and reads AppManifest.xml . </li></ul><ul><li>Plug-in loads Silverlight core services, runtime environment, creates App Domain. </li></ul><ul><li>Plug-in loads application assemblies, dependencies, instantiates Application. </li></ul>
  46. 46. Silverlight Toolkit
  47. 47. Silverlight Toolkit – Overview <ul><li>Developed by Microsoft. </li></ul><ul><li>Iterative, evolutionary model to release new controls and updates more often. </li></ul><ul><li>Components categorised into Mature/SDK, Stable, Preview and Experimental quality bands. </li></ul><ul><li>Recent updates in July 2009, Oct 2009, Nov 2009. </li></ul>
  48. 48. Silverlight Toolkit – Controls <ul><li>AutoCompleteBox </li></ul><ul><li>Calendar </li></ul><ul><li>ChildWindow </li></ul><ul><li>DataGrid </li></ul><ul><li>DataPager </li></ul><ul><li>DatePicker </li></ul><ul><li>GridSplitter </li></ul><ul><li>HeaderedItemsControl </li></ul><ul><li>TabControl </li></ul><ul><li>TreeView </li></ul><ul><li>DockPanel </li></ul><ul><li>Expander </li></ul><ul><li>HeaderedContentControl </li></ul><ul><li>Label </li></ul><ul><li>NumericUpDown </li></ul><ul><li>Viewbox </li></ul><ul><li>WrapPanel </li></ul>Accordion Charting DataForm DomainUpDown ImplicitStyleManager LayoutTransformer Rating TimePicker TimeUpDown GlobalCalendar TransitioningContentControl TreeMap BusyIndicator [Drag and Drop support for items controls]
  49. 49. Silverlight Toolkit – TreeView Control
  50. 50. Silverlight Toolkit – DataGrid Control <ul><li>[Screenshot removed due to data content] </li></ul>
  51. 51. Silverlight Toolkit – DataGrid Control
  52. 52. Sample Silverlight Data Maintenance Application
  53. 53. Sample Application – Technologies Used <ul><li>Built using: </li></ul><ul><li>Visual Studio 2008 </li></ul><ul><li>Silverlight 3 </li></ul><ul><li>Silverlight 3 SDK (e.g. SlSvcUtil.exe) </li></ul><ul><li>Silverlight Toolkit </li></ul><ul><li>WCF </li></ul><ul><li>C# 3.0 </li></ul><ul><li>Enterprise Library 4.1 & T-SQL sprocs </li></ul>
  54. 54. Sample Application – UI <ul><li>[Screenshots removed due to data content] </li></ul>
  55. 55. Sample Application – Controls Used <ul><li>Demos the following Silverlight controls: </li></ul><ul><li>Grid, Image, TextBlock, TextBox, ComboBox, CheckBox, Button, ScrollViewer </li></ul><ul><li>Demos the following Toolkit controls: </li></ul><ul><li>DockPanel, GridSplitter, TreeView, TabControl, DataGrid, DataForm, AutoCompleteBox </li></ul>
  56. 56. Sample Application – Demo <ul><li>[Break out into Visual Studio for demo of application, and a detailed look at the code] </li></ul>
  57. 57. The Model-View-ViewModel Pattern
  58. 58. Model-View-ViewModel – Overview <ul><li>A design pattern that originated from Microsoft. </li></ul><ul><li>A specialisation of Martin Fowler’s PresentationModel pattern. </li></ul><ul><li>Based on Model-View-Controller pattern. </li></ul><ul><li>Targeted at UI development platforms – Silverlight / WPF. </li></ul>
  59. 59. Model-View-ViewModel – Objectives <ul><li>Separation of concerns – decoupling of presentation, business logic and data layers allows an application to be developed in multiple work-streams. </li></ul><ul><li>Testability – eliminate virtually all code from UI e.g. from code-behind .xaml.cs code files. Each layer can be unit-tested independently. </li></ul>
  60. 60. Model-View-ViewModel – Description <ul><li>Model – refers to the data access layer. </li></ul><ul><li>View – refers to visual elements used by the UI e.g. textboxes, buttons, and other controls. Uses two-way data binding in XAML to bind to the ViewModel. </li></ul><ul><li>ViewModel – an abstraction of the View used to facilitate data binding between the View and the Model. Exposes public properties and commands. </li></ul>
  61. 61. Model-View-ViewModel in Silverlight <ul><li>Need the ability to for UI layer to bind directly to commands in the ViewModel. </li></ul><ul><li>Unlike WPF, there is no built-in command mechanism in Silverlight 3. </li></ul><ul><li>Can implement easily in Silverlight using ICommand interface and dependency properties (see sample M-V-VM app). </li></ul><ul><li>Commands implemented in libraries such as Prism, Caliburn and Silverlight.FX. </li></ul>
  62. 62. Sample M-V-VM Silverlight App – UI <ul><li>[Screenshots removed due to data content] </li></ul>
  63. 63. M-V-VM Sample – Technologies Used <ul><li>As with first POC shown, built using: </li></ul><ul><li>Visual Studio 2008, Silverlight 3, Silverlight Toolkit, C# 3.0, EntLib 4.1, T-SQL sprocs </li></ul><ul><li>But also uses the following: </li></ul><ul><li>.NET RIA Services </li></ul><ul><li>Silverlight Unit Test Framework </li></ul><ul><li>Unity Application Block 1.2 </li></ul><ul><li>Rhino Mocks 3.5 for Silverlight </li></ul><ul><li>[And a lightweight M-V-VM framework] </li></ul>
  64. 64. Sample M-V-VM Silverlight App – Demo <ul><li>[Break out into Visual Studio for demo of application, detailed look at the code, unit tests, integration tests with UI automation, and explanation of the benefits of using Model-View-ViewModel] </li></ul>
  65. 65. Silverlight Unit Test Framework
  66. 66. Unit Testing in Silverlight <ul><li>VS Test projects cannot target the Silverlight &quot;CoreCLR&quot; Runtime as used by Silverlight Applications and Silverlight Class Libraries built with Silverlight 3. </li></ul>
  67. 67. Silverlight Unit Test Framework <ul><li>Unit tests run inside the browser. </li></ul><ul><li>Supports testing of Silverlight Class Libraries. </li></ul><ul><li>Allows testing of Silverlight Applications and UI controls. </li></ul><ul><li>Includes basic support for asynchronous testing. </li></ul><ul><li>Can use in conjunction with classes in System.Windows.Automation for UI integration tests (simulating button clicks). </li></ul>
  68. 68. Silverlight Unit Test Framework <ul><li>[Sourced from SUT Framework website] </li></ul>
  69. 69. Silverlight Unit Testing <ul><li>See also Jamie Cansdale's Silverlight NUnit Project Template, which can be used with TestDriven.NET. </li></ul>
  70. 70. Third Party Products
  71. 71. Third Party Products <ul><li>In addition to: </li></ul><ul><li>Silverlight Toolkit on CodePlex </li></ul><ul><li>Silverlight Unit Test Framework </li></ul><ul><li>There is an increasing range of support: </li></ul><ul><li>Controls from vendors such as Infragistics, ComponentArt, Telerik and DevExpress. </li></ul><ul><li>Rhino Mocks 3.5 for Silverlight </li></ul><ul><li>Unity Application Block 1.2 for Silverlight </li></ul>
  72. 72. Silverlight 4 Beta
  73. 73. Silverlight 4 – What’s New (selected) <ul><li>Support for .NET 4 CLR – same compiled code can run on desktop and Silverlight without change. </li></ul><ul><li>Elevated privileges and other improvements in OOB applications. </li></ul><ul><li>Printing API. </li></ul><ul><li>New RichTextBox control, and more. </li></ul><ul><li>Support for drag & drop. </li></ul><ul><li>Support for right-click. </li></ul>
  74. 74. Silverlight 4 – What’s New (selected) <ul><li>MouseWheel support on many controls. </li></ul><ul><li>Data-binding improvements. </li></ul><ul><li>SelectedValue and SelectedValuePath properties on Selector controls. </li></ul><ul><li>Implicit styles. </li></ul><ul><li>Managed Extensibility Framework. </li></ul><ul><li>Webcam/Mic support. </li></ul><ul><li>Support for Google Chrome. </li></ul><ul><li>Silverlight Designer in VS2010. </li></ul>
  75. 75. Summary
  76. 76. Summary <ul><li>Silverlight is a rapidly-maturing technology which is increasingly difficult for .NET developers to ignore. </li></ul><ul><li>Built-in functionality and third party support enables development of highly-responsive, robust line-of-business applications. </li></ul><ul><li>Can use modern design patterns such as Model-View-View-Model to enable separation of concerns and unit-testing. </li></ul>
  77. 77. Useful Links
  78. 78. Useful Links #1 <ul><li>The Official Microsoft Silverlight Site </li></ul><ul><li>http://www.silverlight.net/ </li></ul><ul><li>Get Started Building Silverlight 3 Applications </li></ul><ul><li>http://silverlight.net/getstarted/ </li></ul><ul><li>Silverlight Toolkit </li></ul><ul><li>http://silverlight.codeplex.com/ </li></ul><ul><li>The Model-View-ViewModel Design Pattern for WPF </li></ul><ul><li>http://msdn.microsoft.com/en-us/magazine/dd419663.aspx </li></ul><ul><li>Silverlight Unit Test Framework </li></ul><ul><li>http://code.msdn.microsoft.com/silverlightut </li></ul><ul><li>Unity Application Block 1.2 for Silverlight – December 2008 </li></ul><ul><li>http://www.microsoft.com/downloads/details.aspx?FamilyID=0991cedb-953a-4367-a2b6-071e31766b4c&DisplayLang=en </li></ul>
  79. 79. Useful Links #2 <ul><li>WCF RIA Services (formerly known as .NET RIA Services) </li></ul><ul><li>http://silverlight.net/getstarted/riaservices/ </li></ul><ul><li>WCF RIA Services - Forum </li></ul><ul><li>http://forums.silverlight.net/forums/53.aspx </li></ul><ul><li>Infragistics Silverlight Controls for Line of Business </li></ul><ul><li>http://www.infragistics.com/dotnet/netadvantage/silverlight/line-of-business.aspx </li></ul><ul><li>Infragistics Silverlight Controls for Data Visualisation </li></ul><ul><li>http://www.infragistics.com/dotnet/netadvantage/silverlight/data-visualization.aspx </li></ul><ul><li>What’s New in Silverlight 4 Beta </li></ul><ul><li>http://silverlight.net/getstarted/silverlight-4-beta/#whatsnew </li></ul>

×