710 likes | 867 Views
Developing Windows and Web Applications using Visual Studio.NET Session #9: Silverlight. Gerard Beckerleg. Admin Stuff. Attendance You initial sheet Hands On Lab You get me to initial sheet Certificate At end of 10 sessions If I say if you have completed successfully . Last week.
E N D
Developing Windows and Web Applications using Visual Studio.NETSession #9: Silverlight Gerard Beckerleg
Admin Stuff • Attendance • You initial sheet • Hands On Lab • You get me to initial sheet • Certificate • At end of 10 sessions • If I say if you have completed successfully
Last week • Reporting • ASP.NET MVC
Last week - Additional • Connectionstring • (local)vslocalhostvs. • http://weblogs.asp.net/jgalloway/archive/2005/12/02/432062.aspx • Shared memory comes always first on local machine • http://msdn.microsoft.com/en-us/library/ms187662.aspx
Agenda • Silverlight • Rich interactivity
Agenda - Silverlight • Why Silverlight? • RIA Competitors • Getting started with Silverlight • Silverlight under the hood • Cool stuff • Pros / Cons
Microsoft Silverlight is a cross-browser, cross-platform implementation of .NET for building and delivering the next generation of media experiences & rich interactive applications for the Web.
How a web page is shown Your Computer Hosting Computer Internet The Internet Client Server
All of the intelligence and data is on the server Request www.ssw.com.au The Internet Response HTML Client Server
Typical Client Server • Typical Client Server
Typical Silverlight • Typical Client Server
Pain with web applications • Developers - UI is hard to develop • Testing - Different browser different UI • Performance - Request / Response • Scalability - Server based • Intelligence on the client requires JavaScript/jQuery Bottom line: The browser sux
We want • Easy to develop and maintain • Write once, run anywhereJava slogan, when Sun introduced Java 1.0 1996 • Awesome User experience • Look • Feel • Usability
The Answer: Rich Internet Applications • Side step the browser • Features/functionality of traditional desktop applications • State maintained on BOTH client and server • Run within a secure web browser environment (a sandbox) • No additional software installation • http://www.mscui.net/PatientJourneyDemonstrator/
RIA • Initial Download • Stateful client - Changes to the view don't require [re]loading a new page • Engine – browser extension • Program logic (executes compiled programs) • Rendering user interface • Server communication
Silverlight = RIA from MS • Cross platform • Browser plug in • Rich Internet Application • .NET / CLR in the browser (VB/C#) • 4MB download • Simple install • Competes with other products
User Expectations UI Quality
What platform • Choice of platform based on richness vs. reach • Goal: Parity in developer productivity Richness Reach
What platform • Choice of platform based on richness vs. reach • Goal: Parity in developer productivity Richness Reach
Silverlight "History" • 2000 ~ .NET • .NET platform for Windows and Web applications • AJAX: Web feel like Desktop • WPF: (Windows Presentation Foundation) • Separate UI from Code • Too much • Not Cross browser • WPFe (everywhere) • Silverlight
Silverlight 1 and 2 • Show videos like flash • Implementing the same full (CLR) version as .NET Framework 3.0 (SL2) • Its compiled into .NET assemblies which are then compressed using ZIP and stored in a .xapfile (SL2) • Includes Deep Zoom, a technology (SL2)
Silverlight 3 • Data binding • SupportsAdvanced Audio Coding (AAC) • SupportsOut-of-Browser experiences • ClearType text rendering
Silverlight 4 • RIA services. • Web cam and microphone support. • Printing support. • New and enhanced controls such as a RichTextBox and an enhanced DataGrid control.
RIA Competitors • HTML 5 • Adobe Flash, Flex • Flash: Technology for animations • Flex: Collection of tools to dev Flash apps • Java applets / applications • JavaScript / AJAX • Google's GWT framework (Google Web Toolkit) • JQuery • Microsoft Silverlight
"Hello World" - XAML <UserControl x:Class="SilverlightApplicationHelloWorld.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300"> <StackPanel> <Button Width="400" Height="20" Content="Click me" Click="Button_Click"></Button> <TextBlock x:Name="textblockOutput" Width="400" Height="20" Text="empty"></TextBlock> </StackPanel> </UserControl>
"Hello World" private void Button_Click(object sender, RoutedEventArgs e) { textblockOutput.Text = "Hello World"; }
XAML Defines .Net Objects <TextBlockFontSize="32" Text="Hello world" /> • ≡ TextBlock t = new TextBlock(); t.FontSize = 32; t.Text = "Hello world";
XAML • XML eXtensible Mark-up Language • X Application ML • UI mark-up language • Used in • Silverlight, WPF (and Work Flow) • Tools • Visual Studio, Expression Blend, Notepad • Can generate UI with code or XAML (faster)
Access Elements from Code • Name your XAML elements <Rectangle x:Name="rectOne" /> void OnMouseEnter(object sender, MouseEventArgs e) { rectOne.Height= 75; }
Silverlight Tooling • Expression • Design • Blend 4 • Visual Studio • Visual Studio 2010 • Silverlight Tools for Visual Studio 2010 • Silverlight SDK
Silverlight Limitations • PIX
Silverlight Limitations #1 • No full access to Windows API & .NET API • Silverlight is a subset of .NET framework • WPF features not in Silverlight: • http://msdn.microsoft.com/en-us/library/cc903925(VS.95).aspx • Hardware acceleration • 3D graphics • Resources • Drawing types • Flow text • Doc Panel • Triggers
Silverlight Limitations #2 • Hosting Silverlight • in Windows Forms application • In Office • No sandbox customization • No external API calls (e.g. P/Invoke, COM, full .NET) • No Office integration
Silverlight Limitations #3 • No Secure SaveAs dialog *FIXED IN SL3* • SL3 introduced a secure SaveAs dialog
Silverlight Limitations #4 • Offline support *FIXED IN SL4* • SL4 introduced Isolated Storage • No Sync Framework – manual code • No local DB – no normal SQL • Out of Browser support although more limited than WPF • http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSilverLight/Pages/Doyouofferout-of-browsersupport.aspx
Silverlight Limitations #5 • No Context menu • No Right Click Event • No context menu triggered by Right Click. • Hacks exists but are not recommended due to the need to put the SL plug-in in windowless mode, introducing performance issue • No “Right click – Open in new tab”
Silverlight Limitations #6 • No printing support • Server side PDF or Open XML generation • Client side manual HTML generation. Need to implement the formatting logic twice one for XAML and one for HTML • Final version of SL 3 should provide more “hacks” for generating bitmaps from visuals enabling some more options for client side printing compared to the manual HTML generation. Still done through HTML bridge. This will for example enable printing of Charts.
Silverlight Limitations #7 • Cross domain access • http://weblogs.asp.net/jgalloway/archive/2008/12/12/silverlight-crossdomain-access-workarounds.aspx
Silverlight Cooool • Business Apps • http://www.mscui.net/PatientJourneyDemonstrator • Cool SL games • http://www.silverarcade.com/ • Silverlight shop • http://www.eastberlinshop.com/