12. “Rich Internet Applications (RIAs) are web applications that have many of the characteristics of desktop applications, typically delivered either by way of a site-specific browser, via a browser plug-in, or independently via sandboxes or virtual machines” – WikipediaThe term RIA introduced in white paper in Mar 2002 by Macromedia (now Adobe),though the concept had existed for many years earlier under names such as: Remote Scripting, by Microsoft, circa 1998 X Internet, by Forrester Research in October 2000 Rich (web) clients Rich web application
13.
14. Modular and loosely coupled web app architecture that supports flexibility and user-level customization
18. RIA Landscape – Other tools in Market Flash Multimedia platform used to add animation, video, and interactivity to Web pages. Frequently used for advertisements and games. Manipulates vector and raster graphics to provide animation of text, drawings, and still images. Supports streaming of audio and video. Can capture user input via mouse, keyboard, microphone, camera. Coded in an Object-oriented language called ActionScript. May be displayed on various computer systems and devices, using Adobe Flash Player, which is available free of charge for common Web browsers, some mobile phones and few devices. Flex SDK for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform. Can be written using Adobe Flash Builder or by using the freely available Flex compiler from Adobe.
19. RIA Landscape – Other tools in Market AIR (Adobe Integrated Runtime) Cross-platform runtime environment developed by Adobe Systems for building rich Internet applications using Adobe Flash, Adobe Flex, HTML, or Ajax, that can be deployed as desktop applications. Development Environment HTML/Ajax, either via Adobe's own Dreamweaver CS4 (In addition to Dreamweaver CS3), another HTML editor or a normal text editor in conjunction with the AIR SDK Adobe Flash Builder (formerly Adobe Flex Builder) Flash CS4
20. RIA Landscape – Other tools in Market Java Applet / JavaFX Java platform for creating and delivering RIAs that can run across wide variety of connected devices. Enables building apps for desktop, browser and mobile phones. TV set-top boxes, gaming consoles, Blu-ray players and other platforms are planned. Developers use a statically typed, declarative language called JavaFX Script; Java code can be integrated into JavaFX programs. JavaFX is compiled to Java bytecode, so JavaFX applications run on any desktop and browser that runs the Java Runtime Environment (JRE) and on top of mobile phones running Java ME. On desktop, the current release supports Windows XP, Vista and Mac OS X OS. JavaFX 1.2 would support Linux and OpenSolaris On mobile, JavaFX is capable of running on multiple mobile operating systems, including Symbian OS, Windows Mobile, and proprietary real-time operating systems.
36. Extensions to JavaScript- Provides extensions to the universal browser scripting language that provide control over the browser UI, including ability to work with WPF elements.
38. Integration with existing applications - Integrates seamlessly with existing JavaScript and ASP.NET AJAX code to complement existing functionality.
39. Access to the .NET Framework programming model – could be created using dynamic languages such as IronPython as well as languages such as C# and VB.
40. Networking support - Includes support for HTTP over TCP. You can connect to WCF, SOAP, or ASP.NET AJAX services and receive XML, JSON, or RSS data.
44. Core presentation framework - Components and services oriented toward the UI and user interaction, including user input, lightweight UI controls for Web apps, media playback, data binding, vector graphics, text, animation, and images. Also includes XAML for specifying layout.
45. .NET Framework for Silverlight - A subset of the .NET Framework that contains components and libraries, including data integration, extensible Windows controls, networking, base class libraries, garbage collection, and CLR.
55. Application and Programming Model Provides two distinct models for app development: Managed API for Silverlight - uses code running on CLR for Silverlight. Could be used with compiled languages (VB, C#) or dynamic languages such (IronPython, IronRuby) JavaScript API for Silverlight - uses JavaScript code interpreted by the browser. Both can not be used at the same time within a single instance of the Silverlight plug-in. However, you can implement a splash screen that uses the JavaScript API and then transitions to the managed API when your application has loaded. Managed API provides significantly more functionality than JavaScript API. Managed API apps have access to lightweight version of .NET Framework. JavaScript API, however, has access only to the Silverlight presentation core and the browser JavaScript engine.
56. Managed Programming & Application Model Managed API enables you to bundle managed assemblies and resource files into application package (.xap) files. Silverlight plug-in is responsible for loading an application package and extracting its contents. Application package must contain an assembly with a class derived from Application. Application class encapsulates interaction between appand the Silverlight plug-in. Also provides application lifetime events & resource management. Silverlight documentation uses “application model” to refer to application packaging and the common functionality encapsulated by the Application class.
62. Host: Allows code to interact directly with the Silverlight plug-in that hosts it.
63.
64. Application Structure Silverlight apps are deployed as .xap package (xaml app package) An application package is a zip file (compressed using the Deflate algorithm) that has a .xap file extension. For Silverlight-based apps using the managed API, build process generates an application package. While embedding Silverlight plug-in in web page, specify app package that the plug-in should download. Plug-in uses a manifest file in application package to identify the application class to instantiate. This class is known as the entry point of your application, and it must derive from the Application class.
66. XAP Package A XAP App package contains the following - One AppManifest.xaml file, which identifies the packaged assemblies and the application entry point. One application assembly, which includes your application class. Zero or more library assemblies. Zero or more loose resource files, such as images or video files.
67. Application Manifest <Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly="Silverlight3App" EntryPointType="Silverlight3App.App" RuntimeVersion="3.0.40818.0"> <Deployment.Parts> <AssemblyPart x:Name="Silverlight3App" Source="Silverlight3App.dll" /> </Deployment.Parts> </Deployment> AppManifest.xaml file is typically generated by build process, and uses XAML markup to declare a Deployment object. EntryPointAssembly and EntryPointType attributes to identify the application entry point. RuntimeVersion attribute to identify required version of Silverlight.
100. Layout System Silverlight plug-in defines area that Silverlight-based appis displayed in – Embed plug-in in a host HTML page; Either position plug-in somewhere inline in HTML page display or have plug-in take up entire HTML page. Two frames of reference when positioning Silverlight objects: Within the plug-in: Position objects on the Silverlight surface within the plug-in’s bounding box. Most of the layout overviews describe this type of positioning. Within the HTML: The entire plug-in and all the objects positioned within it are subject to where you place the plug-in in HTML.
101. Layout related properties Margin (of type Thickness) Padding (of type Thickness) HorizontalAlignment Left, Right, Center (Default), Stretch VerticalAlignment Bottom, Top, Center (Degault), Stretch HorizontalContentAlignment Left, Right, Center (Default), Stretch VerticalContentAlignment Bottom, Top, Center (Degault), Stretch Zindix (for Canvas only) Margin Padding Margin Padding <Button Height="120" Width="180" Content="Hello"Margin="50" Padding="40" /> <Button Height="120" Width="180" Content="Hello"Margin="20,40,60,80" Padding="10,30,50,70" />
127. Video Brush Example <MediaElement x:Name="videoMediaElement" Source="Wildlife.wmv" Visibility="Collapsed" /> <TextBox Height="300" Width="400"FontSize="20" Foreground="LightYellow" Text="This is using Video Brush"> <TextBox.Background> <VideoBrushSourceName="videoMediaElement" /> </TextBox.Background> </TextBox>
156. Template Template allow separate appearance of control from it’s behavior and logic. Button: appearance is the raised area that you can press, and the behavior is the Click event that gets raised in response to a click. The source code for every control is completely separated from its default visual tree representations. Template allows to completely replace an element’s visual tree, while keeping all of its functionality intact. Default visuals for every Control in WPF are defined in templates (and customized for each Windows theme). There are three types of Templates ControlTemplate DataTemplate ItemsPanelTemplate
164. By applying these attributes on data class or member, you centralize the data definition and do not have to re-apply the same rules in multiple places.
185. All validation attributes derive from the ValidationAttribute class. The logic to determine if a value is valid is implemented in the overridden IsValid method.
189. Source object that contains the data that flows between the source and target. Source can be any CLR object.
190. Target UI property that displays and possibly allows user changes to the data - can be any DependencyProperty of a FrameworkElement.
191. Direction of the data flow. The direction is specified by setting the Mode property on the Binding object.
192.
193. Data Form <dataFormToolkit:DataForm x:Name="dfPerson" AutoEdit="False"AutoCommit="False" /> dfPerson.CurrentItem = new Person{FirstName="Aniruddha", LastName="Chakrabarti",Age=35};
216. If IsFullScreen property to true, the Silverlight plug-in displays in full-screen mode; otherwise, the plug-in displays in embedded mode.Registers Application Events Toggles Content.IsFullScreen Mode when mouse left button down event is fired.
219. Silverlight-based apps can be configured, so that users can install them from their host Web pages and run them outside the browser.
220. Configuration is a simple matter of providing additional information about an application. This information is supplied through the application manifest.
221.
222.
223. Out of Browser settings <OutOfBrowserSettingsShortName="SL4App Application"EnableGPUAcceleration="False"ShowInstallMenuItem="True"> <OutOfBrowserSettings.Blurb>SL4App Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb> <OutOfBrowserSettings.WindowSettings> <WindowSettingsTitle="SL4App Application"Height="250"Width="350"Top="100"Left="75"WindowStartupLocation="Manual" /> </OutOfBrowserSettings.WindowSettings> <OutOfBrowserSettings.Icons /> </OutOfBrowserSettings>
225. How to whether the app is running Out of Browser if (App.Current.IsRunningOutOfBrowser) { tbMode.Text = "Running Out of Browser"; } Else { tbMode.Text = "Running in Browser"; }
226. How to check the Network status if (NetworkInterface.GetIsNetworkAvailable()) { tbNetwork.Text = "Connected to Network"; } Else { tbNetwork.Text = "Disconnected"; }
227. Save As Dialog (new in SL3) <StackPanelVerticalAlignment="Top" Margin="10" x:Name="LayoutRoot"> <TextBlock>Enter text and Click on Save to save text to local file</TextBlock> <TextBox Height="100" x:Name="textbox" /> <Button Click="Button_Click">Save to local file</Button> </StackPanel> SaveFileDialog dialog = newSaveFileDialog() { Filter = "TextFile (*.txt)|*.txt|WordDoc (*.doc)|*.doc", DefaultExt = "*.txt", FilterIndex = 1 }; bool? result = dialog.ShowDialog(); if (result == true) { Streamstream = dialog.OpenFile(); using (StreamWriterfileWriter = newStreamWriter(stream)) { fileWriter.Write(textbox.Text); fileWriter.Close(); } }
247. Currently Silverlight WCF Framework only supports basicHttpBinding, PollingDuplexHttpBinding and CustomBinding.
248.
249. Use clientaccesspolicy.xml file to allow cross-domain access Create a clientaccesspolicy.xml file that allows access to the service. The following configuration allows access from any other domain to all resources on the current domain.
250.
251. Feed - collection of application data that consists of some feed-level metadata (title, author, URL, and other metadata) and a series of feed items.
252. Within the feed, feed items are ordered in reverse chronological order.
281. Clipboard Access Silverlight 4 adds ability to programmatically access clipboard to format and modify data during copy, cut, and paste operations. Copy: Clipboard.SetText(rtb.Selection.Text); Paste: rtb.Selection.Text = Clipboard.GetText(); Cut: Clipboard.SetText(rtb.Selection.Text); rtb.Selection.Text = "";
283. Verified / Unverified Application Security Warning for Unverified App Security Warning for Verified App
284. Silverlight Performance Test on Multiple Platforms and Browsers Set EnableFrameRateCounter to true During Development Use Transparent Background for a Silverlight Plug-in Sparingly When Animating the Opacity or Transform of a UIElement, set its CacheMode Cache Visual Elements when Blending layers using Opacity and Rotating or Stretching Objects Avoid Using Windowless Mode Use Visibility Instead of Opacity Whenever Possible Silverlight Uses Multi-Core in Rendering and Media In Full-Screen Mode, Hide Unused Objects
285. Silverlight Performance (Cont’d) Do Not Use Width and Height with MediaElement Objects Do Not Use Width and Height with Path Objects Break Up CPU-Intensive Work into Smaller Tasks Break Up Large Application Packages Use Double.ToString(CultureInfo.InvariantCulture) Rather Than Double.ToString() Use Stretch="Fill" When Rendering a Lot of Images Perform time-consuming operations on a background thread using BackgroundWorker class.
287. Silverlight Security Model By default, Silverlight apps are hosted in browser and run in an environment that restricts access to user's computer . Operate within partial-trust security boundary - called a sandbox. Silverlight apps run in a different security context than the rest of the HTML page that hosts the Silverlight plug-in. Cannot access file system and other system resources in the same way as traditional .NET applications. These actions can still be performed, but they typically must be initiated by the user. Otherwise Silverlight throws SecurityException exception. Despite the restricted execution environment, there are some security considerations when you build Silverlight applications. Silverlight 4 and later applications can be configured to run in elevated trust, which also has security implications.
288. Silverlight Security Apps operate within a partial-trust security boundary (sandbox). Cannot access the file system and other system resources in the same way as traditional .NET applications. This sandbox environment is enabled by a security model. In the context of security within the application, there are two code types in Silverlight: platform code and application code. Platform code is the API provided by the Silverlight runtime and SDK. Application code is the code that you write by using the platform code. Silverlight runtime can detect code type based on location of code assembly and by checking the public key of assembly. If an assembly is loaded from the Silverlight runtime or SDK installation directory, is signed with a public key from Microsoft, and meets some additional requirements, the assembly can contain platform code. This means that Silverlight application code is never considered to be platform code.