270 likes | 438 Views
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) Performance Tips for SilverLight Apps
E N D
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) • Performance Tips for SilverLight Apps • Chapter 8 – Downloading Input on Demand • More Additional Resources
Housekeeping Items • Toll free audio is available at 1-866-836-1423 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 http://blogs.federalsystems.net or by using WebEx File\Transfer function
Student Q&A\Feedback • Are there any questions or comments anyone would like to share with the class?
Week 3 Review Questions • What UIElement control do we use to play .wmv, .wma, and some types of mp3 files? • What property do we use in .xaml to uniquely identify an object (programmatically)? • Name some of the methods we use to control media playback. • 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 events?
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 element?
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 Browsers • 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 Animations
Performance Tips for SilverLight(continued) • 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 systems.
Performance Tips for SilverLight(continued) • In Full-Screen Mode, Hide Unused Objects • 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 • http://msdn.microsoft.com/en-us/bb693295.aspx
Questions? • Break
Demos – More 1.0 Controls • Community Gallery silverlight.net/community/gallerydetail.aspx?cat=3 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 Demand • 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 object
Using Downloaded Content • Downloader exposes open and send methods • Send performs an asynchronous “GET” • Listen for the ‘Completed’ event which signals that download is complete • 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 CreateFromXamlDownloader method in the Completed event handler • 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 once • 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 1) (sample interactive controls) • Performance Tips for SilverLight Apps • Chapter 8 – Downloading Input on Demand
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 experience
Additional Resources • SilverLight ‘How To Topics’ from the MSDN Library http://msdn.microsoft.com/en-us/bb188568.aspx
Optional Home Work • View Live from Redmond: Building a dynamic Silverlight Application using a web service, the downloader, and CreateFromXAML (duration = 60 minutes) Msevents.microsoft.com Search on demand webcasts Event id = 1032356286
Next Class Session – June 12 • I will be out of the office next week. • Week 5 class will be held on June 12 at the usual time. • Agenda: Review Week 4 material Review optional homework Week 5 material will deal with Chapter 9 in the course text (animation).
Questions ? • Feel free to contact me at noah_subrin@sra.com • Thank you for your participation!