Building Rich Web Applications with Microsoft SilverLight

Document Sample
Building Rich Web Applications with Microsoft SilverLight Powered By Docstoc
					Building Rich Web Applications
with Microsoft SilverLight

                  Noah Subrin
                  SRA University
                  Spring 2008
                  Week 4
Today’s Agenda (Week 4)

   Student Q&A
   Week 3 Review Questions
   Take-home lab review (QuickStart 1)
    (sample interactive controls)
o   Performance Tips for SilverLight Apps
o   Chapter 8 – Downloading Input on
   More Additional Resources
Housekeeping Items

   Toll free audio is available at
    Attendee access code: 6259066021

As a courtesy to the class, please
 mute/unmute your phone by
 pressing *6 or press the mute key
 on your phone unless you have
 something to share with the class
Class Slides

   The semesters slides are not yet
    available on the SRA Portal. You
    may download them from my blog
    site or
    by using WebEx File\Transfer
Student Q&A\Feedback

   Are there any questions or
    comments anyone would like to
    share with the class?
Week 3 Review Questions
o   What UIElement control do we use
    to play .wmv, .wma, and some
    types of mp3 files?
o   What property do we use in .xaml
    to uniquely identify an object
o   Name some of the methods we use
    to control media playback.
o   What are the required steps to
    animate a SilverLight object?
More Week 3 Review Questions
   Storyboard and DoubleAnimation
    are two examples of __ objects.
   What animation property do we use
    to describe the length of time it
    takes for an animation to play once?
   What property indicates how
    frequently a timeline should repeat?
   What two properties describe the
    beginning and ending values of the
    property to animate?
More Week 3 Review Questions
   What do we call it when SilverLight
    runs some JavaScript code when an
    event occurs?
   What are some of the mouse events
    we can capture?
   T/F SilverLight natively supports the
    double-click mouse event.
   What do we call support for stylus
    More Week 3 Review Questions

   What function do we call to
    dynamically create SilverLight
    content from a JavaScript string?
   What do we call the concept of an
    event being sent to all of an elements
    ancestor elements?
   How do we programmatically access
    a SilverLight control from a child
SilverLight 1.0 QuickStart Review
   We will proceed with our review of
    SL 1.0 Quickstart and take a look at
    sample controls.
   Hyperlink
   Button
   Slider
    We will view them in split mode in
    Blend 2.0.
    All of the controls use JavaScript
Performance Tips for SilverLight Apps

   Test on Multiple Platforms and
   Set EnableFrameRateCounter to
    true During Development
   Use Transparent Background for a
    SilverLight Plug-in Sparingly
   Use SilverLight Animations Instead
    of Creating Your Own Per-Frame
Performance Tips for SilverLight

   Avoid Animating the Size of Text
   Avoid Using Windowless Mode
   Use Visibility Instead of Opacity
    Whenever Possible
   SilverLight takes advantage of multi-
    core for rendering and media
    playback. Therefore, your
    SilverLight-based applications will
    perform faster on multi-core
Performance Tips for SilverLight

   In Full-Screen Mode, Hide Unused
   Do Not Use Width and Height with
    MediaElement Objects
   Do Not Use Width and Height with
    Path Objects
   When Downloader Finishes, Detach
    Events and Set to Null

   Break
    Demos – More 1.0 Controls
   Community Gallery
    SilverLight Ink Journal
    LCD Clock
    Interactive Asset Allocator

   Wicked Code Demo from Jeff Prosise in
    MSDN Magazine 2008 Launch Edition
    (includes download control)
Chapter 8 – Downloading Content on

   SilverLight 1.0 has a special
    downloader control
   Uses an HTTP GET command that
    does not have to refresh the web
    page similar to AJAX update panel.
   Can download many kinds of file
    types - even .zip files on demand
   Use the SilverLight control‟s
    CreateObject call to instantiate the
Using Downloaded Content
   Downloader exposes open and send
   Send performs an asynchronous
   Listen for the „Completed‟ event
    which signals that download is
   ResponseText property displays the
    downloaded content represented as
    a string
Downloader Tip (p181)

   We can parse and load downloaded
    XAML in a single call using
    method in the Completed event
   This is more efficient because it
    avoids copying the XAML content
    into a temporary string
Another downloader tip p182

   (Repeat of earlier performance tip)
    For best performance detach all
    downloader event handlers and set
    the downloader instance to null
We can download several items at

   Downloader supports retrieving a
    package, like a .zip file
   Tip we can use any file extension
    for our zip file any have it work with
    the downloader, unless it contains
    font files
Chapter 8 Walkthrough

   Displaying a Progress Bar p183
   Progress Bar with Gradient p185
   Progress Bar Customizations p186-7
Summary of what we covered today

   Week 3 Review Questions
   Take-home lab review (QuickStart
    (sample interactive controls)
o   Performance Tips for SilverLight
o   Chapter 8 – Downloading Input on
Downloader object summary

   Downloader object makes it easy to
    manage content effectively
•     Less content downloaded up front
•     We can use zip files to speed up
    our downloads.
•     We can create custom progress
    bars to improve the customer
Additional Resources

 SilverLight „How To Topics‟ from the
  MSDN Library
Optional Home Work

 View Live from Redmond: Building a
  dynamic Silverlight Application
  using a web service, the
  downloader, and CreateFromXAML
  (duration = 60 minutes)
Search on demand webcasts
Event id = 1032356286
Next Class Session – June 12
o   I will be out of the office next week.
o   Week 5 class will be held on June
    12 at the usual time.
o   Agenda:
    Review Week 4 material
    Review optional homework
    Week 5 material will deal with
    Chapter 9 in the course text
Questions ?

   Feel free to contact me at
   Thank you for your participation!