Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro To Silverlight 2.0 Part Two

1,008 views

Published on

http://www.intertech.com/Courses/Course.aspx?CourseID=99428

This presentation is from an Intertech Oxygen Blast on Silverlight.

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

Intro To Silverlight 2.0 Part Two

  1. 1. Silverlight Overview Introducing Silverlight Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 1
  2. 2. Silverlight Overview • We will now walk through a simple Silverlight 2.0 plug-in, which will illustrate the following: • Layout using Grid and Canvas types. • Animation sequence using the DoubleAnimation type. • Invoking a WCF service using basicHttpBinding. • Invoking the WCF service in a non-blocking (async) manner. • Hosting the plug-in via ASP.NET Silverlight web controls. Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 2
  3. 3. Silverlight Overview • As you know, WCF is the preferred manner to build services under .NET 3.0 and higher. • One of the major features of SL 2.0 is that web plug-ins can invoke remote services. • The endpoint can be completely unique from the web server machine. • However, you must currently use httpBasicBinding as your binding type. • You must also configure IIS to allow out of bandwidth calls, via a clientaccesspolicy.xml file installed in the root of your IIS install. Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 3
  4. 4. Silverlight Overview • The WCF Service is quite simple: • A single service interface, returning an array of custom data contracts. • Deployed to IIS. • Let’s see the code… Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 4
  5. 5. Silverlight Overview • SL 2.0 controls (buttons, calendars, sliders, etc) are arranged within various layout managers. • The SL 2.0 content model demands that a Page has 1 direct child element. • This element will almost always be a layout manager type. • Layout managers can nest internal layout managers for finer control. • Currently, SL 2.0 offers the following layout choices. Panel name Meaning in Life Allows for absolute position of content. Very useful for graphical Canvas renderings. Grid Defines a flexible grid area consisting of columns and rows. Arranges child elements into a single line that can be oriented horizontally StackPanel or vertically. Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 5
  6. 6. Silverlight Overview • Here, we are using XAML to define: Notice the same SL 2.0 • A master Grid type divided into four cells. app is running under • Cell 0,0 contains a stylized Button type. Apple Safari and IE 7. • Cell 1,0 contains a custom DataGrid type. • Cell 0,1 is a simple TextBlock. Let’s examine the XAML… • Cell 1,1 contains a set of four animated Ellipse types. Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 6
  7. 7. Silverlight Overview • The corresponding code is very simple. • The Click of the Button results in filling the DataGrid based on a WCF Service call. • Note we are calling the service method in an async manner. • The LMouseDown event of each Ellipse routes to the same handler. • Note that you must reference the System.Windows.Controls.Data.dll assembly to access the DataGrid. Examining the C# code… Could have also used VB code… Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 7
  8. 8. Silverlight Overview • You are not required to use ASP.NET in order to integrate a SL 2.0 plug- in into a web page. • If you wish, you can simply use the <object> tag (and a bit of client side JavaScript) to specify the SL 2.0 plug-in. • Visual Studio will automatically generate such a test page on your behalf. • However, if you are already using ASP.NET, you can simplify your life via the SL 2.0 web controls. • The hosting *.aspx file looks like so: • Notice we are using the System.Web.SilverlightControls.dll assembly. • Notice we are making use of the ASP.NET script manager, which will generate the necessary client side JavaScript. • The ASP.NET <Silverlight> control’s Source property points to the compiled Silverlight app (which take a *.xap file extension). Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 8
  9. 9. Silverlight Overview Examining the HTML / ASP.NET code… Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 9
  10. 10. Silverlight Overview • This was a trivial example of what Silverlight can do. • The Sliverlight web site has much more exotic examples. • However, the basic primitives seen here (XAML+Code+ASP.NET) are identical. • Be sure to check out the “Silverlight Showcase” area to view numerous examples such as the following. Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 10
  11. 11. Silverlight Overview Download: -SL 2.0 SDK -SL SDK docs -Blend 2.5 beta -VS 08 Projects Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 11
  12. 12. Silverlight Overview • Silverlight is a web-centric technology used to created rich interactive web plug-ins. • Silverlight is OS and browser independent. • Windows and Mac OS X are currently supported. • IE, Firefox, Opera and Safari browsers are currently supported. • Visual Studio 2008 can make use of free Silverlight project templates. • Microsoft Expression Blend and Microsoft Expression Design are tools which allow graphical artists generate the look and feel of a Silverlight (or WPF) application. • Silverlight is partially based on several WPF technologies, including XAML, the WPF control model and use of code-files. • Silverlight 2.0 provides a much richer programming model than 1.0: • CLR support. • Support for numerous base class libraries. • Support for managed languages (C#, VB, etc). Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 12
  13. 13. Silverlight Overview • Intertech offers free: • Content packed newsletters • Podcasts through iTunes • YouTube videos • Free Oxygen Blast seminars • Whitepapers and .pdf downloads • For the above and special offers, register for the newsletter at the bottom of our homepage Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 13
  14. 14. Silverlight Overview • In addition to training, Intertech delivers consulting • Intertech delivers consulting on the same topics that we provide training • The mix of training and consulting is who we are: Instructors Who Consult | Consultants Who Teach Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 14
  15. 15. Silverlight Overview • For advanced purchase customers, Intertech offers Elite Rewards™ • Elite Rewards give customers: • Significant savings for advanced purchases • Simplified enrollment • Special benefits like advanced notice of our Oxygen Blast events Copyright © Intertech, Inc. 2007 • www.Intertech.com • 800-866-9884 • Slide 15

×