chris j.t. auld – director, intergen chris.auld@intergen.co.nzchris.auld@intergen.co.nz (@cauld)
Post on 19-Jan-2016
217 Views
Preview:
TRANSCRIPT
Souping Up CRM 4 with Microsoft SilverlightChris J.T. Auld – Director, IntergenChris.auld@intergen.co.nz (@cauld)www.syringe.net.nz
Notes Before We Start
AssumptionsSome prior CRM experienceNo prior Silverlight experienceLike demos where we build stuff
Learning GoalsPractical and Pragmatic techniquesCurrently shipping bits: CRM 4, SL3
Contact meChris Auld (chris.auld@intergen.co.nz)
AgendaOverviewWhat is Microsoft Silverlight? What is XAML?Where to use Silverlight?Tooling for Silverlight: Expression Blend and Visual StudioCalling into MSCRM from SilverlightHosting Silverlight inside the MSCRM UI
A TeaserA Quick Lap Around What We’ll Be Building Today
Demo #1
What is Microsoft Silverlight?A tool from Microsoft for building rich user interfaces that are browser hostedCross-browser (IE, Firefox, Safari)Cross-platform (PC, Mac, Linux*)Does NOT require the.NET Framework installed4 MB download, 4-10 seconds to installIncludes Core .NET FrameworkUse any .NET languages – VB, C#, JavaScript, IronPython, IronRubyRich presentation support – Animation, Inking, Video, Audio etc
*Community built Moonlight project offers Linux support
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 UIE.g. No support for video or audio in out of box UI
Proprietary client side IPSilverlight binaries can be obfuscated
Local ‘Isolated Storage’ provides semi-offline experience
Use desktop development practices on the webCall WCF services, etc…
Silverlight vs WPFSilverlight implements a subset of WPFIt uses the same XAML notationDifferent hosting modelWPF is Microsoft Windows Only, Silverlight is Cross Platform
WPF Requires .NET Framework 3.0 or aboveKey things missing from Silverlight:
No hardware access (Webcams, Microphones, Etc…)Rich text features and flow documentsStyle features simplified – no inheritanceTriggers - not on styles, data or control templatesData binding more limited – no triggers, simplified Binding objectNo dynamic resource support
Still possible to write portable code for WPF + SilverlightSee for more details: http://tinyurl.com/cshosn
XAML: Declarative Programming for Windows
Markup for WindowsBuild applications in simple declarative statementsSerialization of an object tree
Code and content are separateStreamline collaboration between designers and developers
Easy for tools to consume and generate
<Button Width="100">OK <Button.Background> LightBlue </Button.Background></Button>
Button b1 = new Button();b1.Content = "OK";b1.Background = new SolidColorBrush (Colors.LightBlue);b1.Width = 100;
Dim b1 As New Buttonb1.Content = "OK"b1.Background = New _ SolidColorBrush _ (Colors.LightBlue)b1.Width = 100
OK
Hosting Silverlight ApplicationsSilverlight applications are hosted via a Web Browser plug-in using an HTML object tagCan specify HTML displayed if plug-in is missingSilverlight.js helper file allows creation via codeSilverlight uses the Hosts network stack and default credentialsCan use ASP.NET Server Control
<div id="silverlightControlHost"> <script type="text/javascript"> Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”); </script></div>
Silverlight + MSCRM ScenariosUse Silverlight in a Web Portal
Build Silverlight applicationConnect Silverlight application to Microsoft CRM via a WCF ProxyHost Silverlight application in a new or existing web site
Use Silverlight inside the CRM UIBuild Silverlight applicationConnect Silverlight application to Microsoft CRMHost Silverlight application in an ASP.NET page in the ‘ISV’ folderSurface in the CRM UI
Use sitemap.xml to create a link to load it into the main paneUse ISV.config to launch new windowLoad into an iFrame on an entity form
Building out the Silverlight applicationDemo #2: Build It!
Connecting Silverlight to CRM Data• Use WCF and Add Service Reference• Connect via a WCF Proxy on the Server• Lightweight client proxy using HttpWebRequest
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 code
Silverlight Applicatio
n
SOAP1.2
CRM Web Services
We’ll be taking this approach in the demo
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 Applicatio
nWCF
CustomWCF
ServiceWCF
CRM Web Services
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.com
Silverlight Applicatio
nRAW SOAP CRM Web
Services
Help
er
Cross Domain Calls
www.contoso.comcrm.hosting.fabrikam.com
*.XAPWCF Call
GET ClientAccessPolicy.xml
WCF Call
Cross Domain Calls
Silverlight client calls a server’s serviceService is on different domain than that serving the *.xap fileSilverlight rejects callMust download a valid clientaccesspolicy.xml file
Cross Domain Policy Files
Silverlight looks for bothClientAccessPolicy.xml (Silverlight)CrossDomain.xml (Flash format)
File must be in the web roothttp://crm.contoso.com/clientaccesspolicy.xmlhttp://api.flickr.com/crossdomain.xml
Connecting the Silverlight app to CRMDemo #3: Wire It Up!
Working with XAML in Expression BlendDemo #4: Refine UI
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
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-To
Link displayed here
HTML Page and hosted Silverlight application
displayed here
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-To
Link displayed here
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 PageHTML Page hosts Silverlight Control
Passing Context to SilverlightSilverlight supports initialization parameters passed in as a stringWhen using iFrame hosting need to pass through parameters
<div id="silverlightControlHost"> <script type="text/javascript"> Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”); </script></div>
Passing iFrame ParametersConfigure 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}
Pass Parameters to SilverlightNeed to take URL with parameters and pass these into Silverlighthttp://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>
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"];
Hosting Silverlight in an iFrame with Context
Demo #5: Host it!
SummaryWhat is Microsoft Silverlight?Where to use Silverlight?Intro to XAMLCalling into MSCRM from SilverlightHosting Silverlight inside the MSCRM UI
Code on my blog later todayhttp://www.syringe.net.nz
© 2008 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
top related