6. Outside data Public Internet mashup APIs Existing Intranet services New services you build RSS/Atom Feeds Images Sounds Videos
7. A bit of history: Silverlight 1 JavaScript HTML ? AJAX (XmlHttpRequest) 1.0 <XAML/> Public Internet mashup APIs Existing Intranet services New services you build RSS/Atom Feeds Images Sounds Videos
8. Today: Silverlight 2 2 Managed Code (C#/VB) HTML Public Int e rnet mashup APIs Existing Intr a net services New services you build RSS/Atom Feeds Images Sounds Videos
9. Services that describe themselves Computer-Readable Metadata (e.g. WSDL) Automatic Proxy Generation WCF SOAP services in the enterprise Services for your Silverlight project ADO.NET Data Services SOAP services on the Internet
10. Securing Silverlight Services Silverlight will use auth. info in the browser HTML E.g.: ASP.NET Login User: Password : Credentials Auth info (e.g. cookie) Service calls + Auth info Silverlight code does not normally deal with credentials… DiveLog.com …/Login.aspx ../MyApp.aspx ../MyService.svc
11. HTTP Requests in Silverlight HttpWebRequest High-level components and User Code Browser Plugin APIs Web Browser - Cookies - Authenticated sessions - Caching - Proxy server to use Windows/Mac Networking Layer Restrictions Restrictions
17. Different people reading about MVC in different places take different ideas from it and describe these as “MVC”. Martin Fowler, GUI Architectures Essay
19. Data & Domain Logic (Model) UI (View) Interaction (Controller/Presenter)
20. Represent the state and behavior of the presentation independently of the GUI controls used in the interface. Martin Fowler, Presentation Model Essay
21. Makes your app easier to design …makes the designers like you
23. Presentation Model Change notification Data-binding and commands Data Model View XAML Code-Behind Presentation Model State + Operations
24. Dive Log Presentation Model Change notification Data-binding and commands Dive Log Service Dive Log XAML Code-Behind Dive Log View Model State + Operations
30. Objects are used to represent actions. A command object encapsulates an action and its parameters. This allows a decoupling of the invoker of the command and the handlers of the command.
31. Commands in Silverlight View < Button Content ="Save Dives" input:CommandService.Command ="SaveDives" /> Presentation Model public PageViewModel() { Commands .SaveDives.Executed += new EventHandler < ExecutedEventArgs >(SaveDives); } private void SaveDives( object sender, ExecutedEventArgs e) { // code to save dives.. }
32. The strategy pattern is a software design pattern, whereby algorithms can be selected at runtime . Presentation Model public PageViewModel() { if ( HtmlPage .IsEnabled) { client = new DiveLogServiceClient (); } else { client = new ServiceStub (); } }
33.
34.
35.
36.
37.
38. IoC Containers Presentation Model [ Inject ] public PageViewModel( IDiveLogServiceClient proxy) { this. proxy = proxy } View public Page() { InitializeComponent(); IKernel iocContainer = new StandardKernel (); this .DataContext = iocContainer.Get< PageViewModel >(); }