Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chris J.T. Auld – Director, Intergen

Similar presentations


Presentation on theme: "Chris J.T. Auld – Director, Intergen"— Presentation transcript:

1 Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld) www.syringe.net.nz www.syringe.net.nz

2 Notes Before We Start Assumptions Some prior CRM experience No prior Silverlight experience Like demos where we build stuff Learning Goals Practical and Pragmatic techniques Currently shipping bits: CRM 4, SL3 Contact me Chris Auld (chris.auld@intergen.co.nz)chris.auld@intergen.co.nz

3 Agenda Overview What is Microsoft Silverlight? What is XAML? Where to use Silverlight? Tooling for Silverlight: Expression Blend and Visual Studio Calling into MSCRM from Silverlight Hosting Silverlight inside the MSCRM UI

4 A Teaser A Quick Lap Around What We’ll Be Building Today

5 What is Microsoft Silverlight? A tool from Microsoft for building rich user interfaces that are browser hosted Cross-browser (IE, Firefox, Safari) Cross-platform (PC, Mac, Linux*) Does NOT require the.NET Framework installed 4 MB download, 4-10 seconds to install Includes Core.NET Framework Use any.NET languages – VB, C#, JavaScript, IronPython, IronRuby Rich presentation support – Animation, Inking, Video, Audio etc *Community built Moonlight project offers Linux support

6 Why use Silverlight with MSCRM? Allows rich LoB UI via a Web Browser Faster UI – Rich UI elements of rapid data I/O Richer UI – Rich graphics for visualization of data Allows Media unsupported by CRM UI E.g. No support for video or audio in out of box UI Proprietary client side IP Silverlight binaries can be obfuscated Local ‘Isolated Storage’ provides semi-offline experience Use desktop development practices on the web Call WCF services, etc…

7 Silverlight vs WPF Silverlight implements a subset of WPF It uses the same XAML notation Different hosting model WPF is Microsoft Windows Only, Silverlight is Cross Platform WPF Requires.NET Framework 3.0 or above Key things missing from Silverlight: No hardware access (Webcams, Microphones, Etc…) Rich text features and flow documents Style features simplified – no inheritance Triggers - not on styles, data or control templates Data binding more limited – no triggers, simplified Binding object No dynamic resource support Still possible to write portable code for WPF + Silverlight See for more details: http://tinyurl.com/cshosnhttp://tinyurl.com/cshosn

8 XAML: Declarative Programming for Windows Markup for Windows Build applications in simple declarative statements Serialization of an object tree Code and content are separate Streamline collaboration between designers and developers Easy for tools to consume and generate OK LightBlue Button b1 = new Button(); b1.Content = "OK"; b1.Background = new SolidColorBrush (Colors.LightBlue); b1.Width = 100; Dim b1 As New Button b1.Content = "OK" b1.Background = New _ SolidColorBrush _ (Colors.LightBlue) b1.Width = 100 OK

9 Hosting Silverlight Applications Silverlight applications are hosted via a Web Browser plug-in using an HTML object tag Can specify HTML displayed if plug-in is missing Silverlight.js helper file allows creation via code Silverlight uses the Hosts network stack and default credentials Can use ASP.NET Server Control Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”); Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”);

10 Silverlight + MSCRM Scenarios Use Silverlight in a Web Portal Build Silverlight application Connect Silverlight application to Microsoft CRM via a WCF Proxy Host Silverlight application in a new or existing web site Use Silverlight inside the CRM UI Build Silverlight application Connect Silverlight application to Microsoft CRM Host Silverlight application in an ASP.NET page in the ‘ISV’ folder Surface in the CRM UI Use sitemap.xml to create a link to load it into the main pane Use ISV.config to launch new window Load into an iFrame on an entity form

11 Building out the Silverlight application

12 Connecting Silverlight to CRM Data Use WCF and Add Service Reference Connect via a WCF Proxy on the Server Lightweight client proxy using HttpWebRequest

13 Connecting Silverlight to CRM Data Use WCF and Add Service Reference –Fast and familiar to CRM developers –Full access to data –Must use Dynamic Entities to work with data –Requires additional headers for CRM Authentication –Requires client to possess clear text credentials –See http://tinyurl.com/c5copm for helper codehttp://tinyurl.com/c5copm Silverlight Application SOAP 1.2 CRM Web Services We’ll be taking this approach in the demo

14 Connecting Silverlight to CRM Data Connect via a WCF Proxy on the Server –Familiar to most.NET developers –Must write code for every type of data you need to access –Can ‘hide’ credentials on the server – suitable for public web sites Silverlight Application WCF Custom WCF Service Custom WCF Service WCF CRM Web Services

15 Connecting Silverlight to CRM Data Lightweight client proxy using HttpWebRequest –Smaller *.xap file loads faster –Full access to data –Requires client to possess clear text credentials –Requires purchase of the XRM Book to get library code –See http://www.thecrmbook.comhttp://www.thecrmbook.com Silverlight Application RAW SOAP CRM Web Services Helper

16 Cross Domain Calls www.contoso.com crm.hosting.fabrikam.com *.XAP WCF Call GET ClientAccessPolicy.xml WCF Call

17 Cross Domain Calls Silverlight client calls a server’s service Service is on different domain than that serving the *.xap file Silverlight rejects call Must download a valid clientaccesspolicy.xml file

18 Cross Domain Policy Files Silverlight looks for both ClientAccessPolicy.xml (Silverlight) CrossDomain.xml (Flash format) File must be in the web root http://crm.contoso.com/clientaccesspolicy.xml http://api.flickr.com/crossdomain.xml

19 Connecting the Silverlight app to CRM

20 Working with XAML in Expression Blend

21 Hosting Silverlight in CRM UI Linked from Main Navigation using SiteMap.xml Opened in a new window using ISV.config Hosted in an iFrame on an entity form

22 Hosting– Link from Main Nav Linked from Main Navigation using SiteMap.xml –Suitable for Dashboards and applications that do not relate to a particular entity. Elements that should appear to be ‘part of CRM’ –Use ‘Dynamics CRM Demonstration Tools’ to edit SiteMap.xml –See http://tinyurl.com/4drvz2 by @ceibner for a good How-Tohttp://tinyurl.com/4drvz2 Link displayed here HTML Page and hosted Silverlight application displayed here

23 Hosting – Open new Window Linked from Main Navigation using SiteMap.xml –Suitable for Applications that should appear to be separate to CRM –Edit ISV.config –use code to merge with existing config data –See http://tinyurl.com/4drvz2 for a good How-Tohttp://tinyurl.com/4drvz2 Link displayed here

24 Hosting – IFrame in Entity Form Hosted in a specific entity form –Suitable for Applications that require their context of a given entity e.g. for a given Contact or Account –Use CRM Customization to create an iFrame on the Entity Form –This is what we’ll be doing in the demo iFrame hosts HTML Page HTML Page hosts Silverlight Control iFrame hosts HTML Page HTML Page hosts Silverlight Control

25 Passing Context to Silverlight Silverlight supports initialization parameters passed in as a string When using iFrame hosting need to pass through parameters Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”); Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”);

26 Passing iFrame Parameters Configure iFrame to pass parameters IFrame will pass through parameters for type, typename and id when loading the hosted page http://yoursite/SLHost.aspx?type=1&typename=account&id={GUID}

27 Pass Parameters to Silverlight Need to take URL with parameters and pass these into Silverlight http://yoursite/SLHost.aspx?type=1&typename=account&id={GUID} <asp:Silverlight ID="Xaml1" runat="server" Source="~/ISV/ClientBin/myExample.xap" MinimumVersion="2.0.30523" > <asp:Silverlight ID="Xaml1" runat="server" Source="~/ISV/ClientBin/myExample.xap" MinimumVersion="2.0.30523" > public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Xaml1.InitParameters += ",id=" + Request["id"]; } public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Xaml1.InitParameters += ",id=" + Request["id"]; } public partial class App : Application { public App() { this.Startup += this.Application_Startup; } private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = new Page(); string id = e.InitParams["id"]; public partial class App : Application { public App() { this.Startup += this.Application_Startup; } private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = new Page(); string id = e.InitParams["id"];

28 Hosting Silverlight in an iFrame with Context

29 Summary What is Microsoft Silverlight? Where to use Silverlight? Intro to XAML Calling into MSCRM from Silverlight Hosting Silverlight inside the MSCRM UI Code on my blog later today http://www.syringe.net.nz http://www.syringe.net.nz

30 © 2008 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Chris J.T. Auld – Director, Intergen"

Similar presentations


Ads by Google