Integrating Silverlight with ASP.NET AJAX and Web Services Dan Wahlin Interface Technical Training

Slides:



Advertisements
Similar presentations
Module 1: Creating Responsive Pages with Ajax Creating Partial-Page Updates by Using AJAX Scripting Actions on the Web Client.
Advertisements

JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
AJAX Development Mike Ormond Developer & Platform Group Microsoft Ltd
1 Visual Studio Enhancements. 2 Integrated Ajax Support Don’t need an Ajax-Enabled Template Automatic Extender Detection Add Extender Wizard.
AJAX – The Future of Web Development? Anders Moberg David Mörtsell David Södermark.
6/3/2015eBiquity1 Tutorial on AJAX Anubhav Kale (akale1 AT cs DOT umbc DOT edu)
1 Chapter 12 Working With Access 2000 on the Internet.
It’s always better live. MSDN Events Developing ASP.NET AJAX Controls with Silverlight.
Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Fundamentals, DOM, Events, AJAX, UI Doncho Minkov Telerik Corporation
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
ASP.NET AJAX. Content ASP.NET AJAX Ajax Control Toolkit Muzaffer DOĞAN - Anadolu University2.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Web 2.0: Concepts and Applications 11 The Web Becomes 2.0.
Web 2.0: Concepts and Applications 11 The Web Becomes 2.0.
JavaScript & jQuery the missing manual Chapter 11
Chapter 6 JavaScript and AJAX. Objectives Explain the purpose and history of JavaScript Describe JavaScript features Explain the event-driven nature of.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
AJAX in ASP.NET James Crowley Developer Fusion
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
XP New Perspectives on XML, 2 nd Edition Tutorial 10 1 WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10.
Chapter 10 – AJAX Dr. Stephanos Mavromoustakos. Chapter Overview AJAX (Asynchronous JavaScript And XML) Ajax allows your client-side web pages to exchange.
ASP.NET Web Server Controls Basic Web Server Controls.
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
AJAX and Atlas in ASP.NET 2.0 William J. Steele MSDN Developer Evangelist Microsoft Corporation
Cross Site Integration “mashups” cross site scripting.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Ventsislav Popov Crossroad Ltd.. 1. What is AJAX?  AJAX Concept  ASP.NET AJAX Framework 2. ASP.NET AJAX Server Controls  ScriptManager, UpdatePanel.
Are you getting the benefits from ASP.NET and AJAX? Introduction to the CTC ASP.NET Webforms Generator.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Telerik Software Academy ASP.NET Web Forms Telerik Software Academy ASP.NET Web Forms.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Developing ASP.NET AJAX Controls with Silverlight Barry Gervin Microsoft Regional Director John Bristowe Developer Advisor, Microsoft.
Satisfy Your Technical Curiosity Building Rich, Highly Interactive Web Apps with WPF/E Jeff Prosise Cofounder, Wintellect
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Ajax for Dynamic Web Development Gregory McChesney.
Chapter 16: Ajax-Enabled Rich Internet Applications with XML and JSON TP2543 Web Programming Mohammad Faidzul Nasrudin.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
 AJAX – Asynchronous JavaScript and XML  Ajax is used to develop fast dynamic web applications  Allows web pages to be updated asynchronously by transferring.
ASP.NET SignalR SoftUni Team Technical Trainers Software University
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Satisfy Your Technical Curiosity WPF/E Jeff Prosise Cofounder, Wintellect
Web 2.0: Concepts and Applications 11 The Web Becomes 2.0.
Eben de Wit Developer Advisor Microsoft
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
ASP.Net ICallback Vijayalakshmi G M Senior Trainer Binary Spectrum.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
1 The World Wide Web Architectural Overview Static Web Documents Dynamic Web Documents HTTP – The HyperText Transfer Protocol Performance Enhancements.
Overview Web Technologies Computing Science Thompson Rivers University.
Building an End-to-End HTML5 App with ASP.NET MVC, EF and jQuery Dan Wahlin.
Customizing Share Document Previews Will Abson Senior Integrations Engineer and Share Extras Project Lead
1/7/2016www.infocampus.co.in1. 1/7/2016www.infocampus.co.in2 Web Development training gives you and all-round training in both the design and the development.
Microsoft Silverlight An Introduction. Silverlight is a cross-browser, cross-platform plug-in* * An auxiliary program that works with a software package.
1 Introducing Web Developer Tools Rapid application development tools ASP.NET-compatible web editors –Visual Studio.NET Professional Edition –Visual Studio.
Introduction to Silverlight
Jim Fawcett CSE686 – Internet Programming Spring 2012
Rajesh Lal ( ) Microsoft Silverlight An Introduction 51PPT模板网 搜集整理 Rajesh Lal (
Working with Client-Side Scripting
Introduction to Silverlight
Microsoft Silverlight
Choosing between Silverlight and AJAX
Presentation transcript:

Integrating Silverlight with ASP.NET AJAX and Web Services Dan Wahlin Interface Technical Training

AlbumViewer Application Overview Creating a Silverlight Canvas and Objects Generating Dynamic XAML Calling Web Services with ASP.NET AJAX Working with Animations and Transformations Summary

The AlbumViewer application relies on the following technologies: Silverlight 1.0 JavaScript ASP.NET AJAX Web Services

Silverlight Client Web Service JSON request JSON response Script Manager 1 1 ScriptService Attribute ScriptService Attribute Proxy Amazon Service 4 4

Resources used in AlbumViewer application: – Silverlight: EmptyTemplate.xaml – Contains main canvas and child objects AlbumTemplate.xaml – Album canvas used for each album – JavaScript: Silverlight.js – Microsoft script that loads Silverlight control Main.js – Contains client-side functionality – ASP.NET AJAX AlbumViewer.aspx – Hosts Silverlight control, scripts, CSS and AJAX functionality – Web Services AlbumService.asmx – Wrapper service used to call Amazon service Amazon.com Web Service – Commerce Service that returns albums

AlbumViewer Application Overview Creating a Silverlight Canvas and Objects Generating Dynamic XAML Calling Web Services with ASP.NET AJAX Working with Animations and Transformations Summary

The AlbumViewer application relies on a parent canvas that defines several objects: – Album title TextBlock – "Loading" message canvas – Albums canvas – Navigation controls canvas – Album details canvas

Album Title TextBlock Albums Canvas Navigation Canvas Album Details Canvas

<Canvas Width="800" Height="600" Name="MainCanvas" xmlns="

Exploring the AlbumViewer Canvas

AlbumViewer Application Overview Creating a Silverlight Canvas and Objects Generating Dynamic XAML Calling Web Services with ASP.NET AJAX Working with Animations and Transformations Summary

AlbumViewer dynamically generates XAML for each album returned from Amazon service: – XAML generated on server-side and sent to client – Minimizes JavaScript file size and complexity XAML template with placeholders is used as the starting template for each album – Provides simple maintenance – Minimizes C#/VB.NET code XAML returned to client using JSON messaging

XAML album template defines canvases with images Template contains placeholders that are dynamically updated as Amazon.com service returns data Completed album XAML is sent back to client Silverlight object for processing

<Rectangle Name='{0}_Rect' Stroke='Gray' StrokeThickness='2' RadiusX='10' RadiusY='10' Width='{3}' Height='{4}' Cursor='Hand' MouseEnter='onMouseEnter' MouseLeave='onMouseLeave' MouseLeftButtonDown='onLeftMouseButtonDown'> … Reflection Rectangle (omitted for brevity) …

public static string[] GenerateXaml(Album[] albums) { List canvases = new List ();....additional code.... for (int i = 0; i < albumCount; i++) { Album a = albums[i]; double angle = i * ((Math.PI * 2) / albumCount); double x = (Math.Cos(angle) * radiusX) + centerX; double y = (Math.Sin(angle) * radiusY) + centerY; double scale = Math.Round((y - perspective) / (centerY + radiusY - perspective),2); //Plugin placeholder values in XAML album template string canvasXaml = String.Format(File.ReadAllText(albumTemplate), a.ID, x.ToString(CultureInfo.InvariantCulture), y.ToString(CultureInfo.InvariantCulture), imageWidth.ToString(CultureInfo.InvariantCulture), imageHeight.ToString(CultureInfo.InvariantCulture), reflectX, a.ImageUrlMedium, scale.ToString(CultureInfo.InvariantCulture)); canvases.Add(canvasXaml); } return canvases.ToArray(); }

Dynamic XAML can be added into a Silverlight control using the CreateFromXaml() method: for (var i=0;i<fragments.length;i++) { try { var newAlbum = _SilverLightControl.Content.CreateFromXaml(fragments[i]); //Add album object into albums canvas _AlbumsCanvas.Children.Add(newAlbum); } catch (e) { _InError = true; }

AlbumViewer Application Overview Creating a Silverlight Canvas and Objects Generating Dynamic XAML Calling Web Services with ASP.NET AJAX Working with Animations and Transformations Summary

AlbumViewer Silverlight control relies on ASP.NET AJAX to access album data ASP.NET AJAX ScriptManager generates service proxy Local Web Service wraps call to Amazon.com Web Service JSON messaging used for request/response messages

Web Service client-side proxy created using the ScriptManager:

Client-side proxy object makes asynchronous postback requests to service and updates XAML: function DoArtistSearch() { var artistText = $get("txtArtist").value; StartStopLoader(true,artistText); InterfaceTraining.AlbumService.AlbumSearch(artistText,"1", onWSRequestComplete,onWSRequestFail); } function onWSRequestComplete(results) { StartStopLoader(false,""); RemoveAlbums(); if (results != null && results != 'undefined') { _Albums = results.Albums; UpdateXaml(results.XamlFragments); }

AlbumViewer Application Overview Creating a Silverlight Canvas and Objects Generating Dynamic XAML Calling Web Services with ASP.NET AJAX Working with Animations and Transformations Summary

Silverlight allows canvas objects to be animated and transformed: – Skew or rotate an object – Move objects to different locations – Fade objects in and out – Change an object's color Animations are placed inside of a element

Objects can be animated using the DoubleAnimation object: <DoubleAnimation Storyboard.TargetName="loaderImageTransform" Storyboard.TargetProperty="Angle" From="0" To="360" Duration="0:0:3" RepeatBehavior="0:0:10" />

Animations can be controlled using JavaScript: function StartStopLoader(start,artistText) { _AlbumDetailsCanvas.Opacity = "0"; _LoadingCanvas.Opacity = (start==true)?"1":"0"; _LoadingCanvas.children.GetItem(2).Text = artistText; _ArtistText.Text = ""; if (start) { _SLControl.Content.FindName("LoadingCanvasAnimation").Begin(); } else { _SLControl.Content.FindName("LoadingCanvasAnimation").Stop(); }

Image reflections can be created using RenderTransform and ScaleTransform objects:

Using Animations and Transformations

Silverlight provides a powerful way to display data and media in a rich medium JavaScript can be used to interact with Silverlight 1.0 canvas objects ASP.NET AJAX features can be integrated into Silverlight 1.0 applications Animations and transformations can be applied to canvas objects

Thanks for Attending! Dan Wahlin Interface Technical Training