Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Silverlight   (RSS)

I did a session last Wednesday (9 Apr) -- introducing our Rich Internet Application technology Silverlight to our MSDN subscribers.

In the session, we re-acquainted with Silverlight 1.0 and its AJAX-like programming model, but dedicated most of the time to introduce Silverlight and the new .NET development paradigm.

Comic Viewer SampleI've put the slides from the presentation, as well as the comics-book viewer sample project used for the code walk-through on my SkyDrive and you can find them here.

 

The sample code demonstrates Silverlight 2 controls (particularly Layout), control data-binding, asynchronous data fetching and LINQ. Much of the work was based off samples by Joe Stegman and Scott Guthrie

imageA Customer who asked if a quiz-type application can be enabled by Silverlight. 

The answer is yes (obviously smile_regular) and I had to put my rusty coding skills to work over a good part of a Saturday afternoon.

The result is a Silverlight 1.0 proof-of-concept application, which meant adopting an "AJAX-styled" coding model with JavaScript. In fact, just for the heck of it, I wanted to go the full client-only approach which meant no ASP.NET AJAX server-side controls, etc.

The code demos a couple of simple features:

  • Quiz questions are easily configurable with a XML data file. The Silverlight application accesses the quiz as JSON data with a simple web service. This was simply achieved by first converting the XML data to JSON format at the server-side with XmltoJSON C# code (made available at http://www.phdcc.com/xml2json.htm). To allow the web service to be accessible (invoke-able) by the client JavaScript, I also marking the web service with the System.Web.Script.Services.ScriptService attribute. 
  • An auto timeout (set to 10 seconds) is set for each quiz, this is done with a XAML animation storyboard to mimic a timer. Jesse Liberty details this useful technique in his blog here.
  • At the client end, I dabbled a little with the JavaScript Prototype library to demonstrate interaction between the Silverlight application and the host browser's DOM.

The application can definitely do with polishing (e.g., with some creative design work, one can imagine fireworks animation when the user gets a correct answer,) but this should serve as a nice simple base for extensions, tearing apart, etc. 

Links:

  • The source code is available for download at my SkyDrive here.
  • The application can also be viewed online here

Play Hellgate London Microsite - http://playhgl.com.sg/silverlightHellgate: London is, of course, the new action role-playing game for the PC platform.  Playworks Online, who distributes the game, will partner SingTel to launch the MMORG system.

Early this year, we worked with the Playworks team to deliver a micro-site that shows video previews of the various character classes, hosted and delivered with Windows Live Silverlight Streaming Service. Check out the Silverlight-enabled site at http://www.playhgl.com.sg/silverlight.

Character Class Video

It was a quick and fun project, working with the cool design folks from Playworks - and we got the site up and running slightly over the span of a week.

The presentation and demo I showed for the 30th January technology briefing session on Rich Internet Applications was based on this project, and a modified version of the source will be made available soon.

0 Comments
Filed under:

On 30th January, we did the first of a planned series of web-related technology talk events -- this time focusing on Web User Experience (UX). I'd like to thank everyone who attended and stayed back late (we overran by 45 minutes!)  I think we had a lively time.

Building the PlayHellgate London Silverlight site

We covered the following in the 3 hour presentation session:

  1. An overview of the spectrum of Microsoft's user experience technologies. This spans from the ubiquitous web-based (such as ASP.NET AJAX) to rich user interfaces leveraging platform capabilities (such as Windows Presentation Foundation, Windows Mobile), and finally to the new class of Rich Internet Applications (enabled by Silverlight.) We also showed (or, in a specific instance, attempted to show smile_regular) real-life applications deployed by customers / partners using these technologies.
  2. Jocelyn (our ISV Developer Evangelist) then did a code-talk / demo session on ASP.NET AJAX. Be sure to check out the ASP.NET AJAX Control Toolkit -- you saw how easy it was to add interactivity to ASP.NET web applications!
  3. We had Yong Hwee from patroids creative works who shared first-hand experience on developing their first project on Silverlight.
  4. I then did a code demo on how we actually developed a real-world Silverlight 1.0 application using Visual Studio and JavaScript. Of course, you can also build video-rich application in 7 steps, and no code with Expression Media Encoder.

My presentation decks for the session can be found on my SkyDrive. You can find Jocelyn's presentation deck (Overview of ASP.NET AJAX) here.

I have also uploaded my two slide decks, which can be accessed from the links below:

(I will be sharing the Silverlight demo code as I clean it up for public consumption, so do check back this blog again in a week or so...)

 

Prelude:

Do keep a look out for the next event entitled "Building Web 2.0 Mash-ups" -- where we will talk and demo building Facebook applications with Visual Studio, creating mash-ups with Windows Live Services, and introduce cool technologies like PopFly, etc.  

This scheduled for the evening of 12 March 2008 -- keep it free!

Microsoft Singapore New Year greeting card Counting down with Silverlight - http://www.office2007quiz.com.sg/greetings/.  Check back again in a couple of days smile_party.  

(Can't wait for the new year to arrive earlier?  Here's the preview.)

More updates in 2 day's time.

Came across this very nice article by Justin-Josef Angel on the Code Project web site -- Silverlight Controls - The Path to Reusable XAML.

I've been working on a few Silverlight 1.0 projects recently, and a consistent struggle on these has been to maintain data-presentation separation, as well as to adhere to object-oriented principles when dealing with JavaScript and XAML.

This article provides the clearest, most prescriptive guidance I've seen to-date on the use of the JavaScript Prototype pattern to support as "code-behind" for XAML-defined user-interface elements. 

JellyBar - One Object Many Instances

Justin-Angel does a code walk-through that refactors Richard Z's JellyBar sample (which emits XAML dynamically in code with JavaScript) into a "One JavaScript class - One XAML file" model. The result, as the author says, is "it's extensible, it's maintainable, it's object oriented."

Also check out the cool trick with with Visual Studio 2008 JavaScript comments syntax in building the "class constructor" function!

To all who celebrate, Merry Christmas! smile_regular

Technorati Tags: ,

Just released, the latest in silverlight applications has been deployed on MediaCorp's Web Site.  This site takes advantage of Rich Application technology through its use of MS AJAX Extensions and the Silverlight plugin.

Well we have entered into the final stages of the development of out next platform for web solutions.  Along with the server itself however a couple of add-ons have also been released.  The first is Windows Media Services which provides the capability to stream video on demand.  The second is the IIS7 Media Pack module that provides bit rate throttling for progressive video downloads. 

Web, Standard, Data Center, and Enterprise editions of WS 2008 RC0 are now available for download along with Windows Media Services.   I had the opportunity to configure a virtual environment showcasing the new caching capabilities of WMS and thought I would share a few of my experiences.

I started with the Idea of running WS Enterprise as my Origin Server and running the Web Server edition as the proxy.  When you first install WS 2008, you will be prompted with the new management interface that makes configuration of role and feature specific functionality incredibly simple.  

 

image image

 

WMS is not available in the existing build, so the first thing you need to do is install the download OOB WMS module.  Once that is done, when you select roles you will be presented with a selection to choose from (Note: the differences between the Web and Enterprise version).  If you happen to select a role that has dependencies on other services, these will be added by default.

 

image image

 

Enabling the caching functionality on the Web version could not be easier.  You select the server you want to configure in our management interface, select the properties TAB, Select Cache/Proxy management, and Right click WMS Cache Proxy enable the functionality.  You can then double click on the same place to get prompted with the configuration options as seen below.  You can also go and do the same on the origin server to control aspects of the caching such expiry time and so on related to the individual publishing points.

 

image image

 

Details on the configuration options available can be found in the help files so I will not go into that here but one thing to keep in mind is the way the proxy is expecting to get requests.  Basically the scenario is that all streaming requests for content off the Origin server need to be routed to the IP of the caching server.  This can be done through firewall configuration but if you are looking to do this in a virtual test environment the easiest way I have found is modify your LMHosts file to resolve requests to the origin server with the IP of the proxy server.  Another point to keep in mind is that HTTP streaming (Only protocol supported by Silverlight!) is not enabled by default.  You need to go into the Properties TAB for the server, select the control protocol and enable a specific open port.

 

image

 

Hope this helps in getting you started on using WMS in WS 2008!

 

John

Hi,

I recently gave a presentation at our Tech Ed in Kuala Lumpur and was asked if I could do a web cast of it.  I am struggling a bit with the resolution right now but here is the first draft.  I have also published the video and the source code for download.

A quick tip on embedding a Silverlight streaming object in your html page...use the new Iframe service.   Embed the following link as the source of an iframe element http://silverlight.services.live.com/invoke/<AccountID>/<ApplicationID>/iframe.html

If you are like me, the recent release of the 1.0 RC version of Silverlight has been a mixed bag.  Clearly the new version has a wealth of new features that make it event better but at the same time these improvements have also broken existing implementations.  Here are some tips to resurrecting your demos and prototypes:

1)  Remove Sys. from all calls to the helper js files.  This namespace has bee deprecated. 

2)  Do a find and replaced on .Hidden with .Collapsed.  Hidden has be deprecated as well.

3)  Use the new silverlight.js files.

4)  If you manually configuring the object/embed tag, use "x-silverlight" instead of "ag-plugin"

5)  If all else fails....download the the 1.0 SDK

Tim Sneath has two exciting posts up on his blog:

Linda and I have been looking forward to the Silverlight 1.0 RC1 release in particular as we are working with several enterprise customers to implement Silverlight here in Singapore.

Tim's blog entry reveals significant improvements in performance, robustness and stability over the beta release.

While Tim also notes to that existing Silverlight beta deployments need to be checked for compatibility, he stresses that this will be the final breaking change.

I learnt from our recent MGX (Microsoft Global Exchange) conference, the product team is hardcore about delivering a "instant-on" experience with Silverlight -- which means fast, seamless in-place installation. RC1 and subsequent versions also incorporates an auto-update capability to simplify the installation process when new releases become available. There are also a lot more exciting features that should appear with Silverlight 1.1.

Our customers are doing some interesting stuffs with Silverlight, and we'll share more when we can...

0 Comments
Filed under:

aa700831_VS08_v(en-us,MSDN_10)

 

Check it out.  The latest in our developer Tools.

In a previous post I documented the steps to install the latest in tools and technologies to support development of Silverlight Applications.  One comment I received was that it seemed like allot to do to just start developing Silverlight Applications.  This may have mislead other people and so I will document how to get started with a minimal software install. 

To begin with you can write a silverlight app in note pad!  Here is an example:  Open a new file and save the following with an .htm extension.  Then open it IE and you can see the result!

<html>
<script type="text/xaml" id="MySilverlight">
    <Canvas xmlns="http://schemas.microsoft.com/client/2007"> 
        <TextBlock  Text="Hello World from my Script Tag"/>
            </Canvas>
</script>
       <object
           type="application/ag-plugin"
            id="myControl"
           width="400"
            height="100">
           <param name="background" value="Red" />
           <param name="source" value="#MySilverlight" />
 </object>
</html>

Obviously this is a simple example but we can see here how this simple xaml fragment and object tag can enable the basic UI instantiation.  There is a lot you can do with XAML but to really enable interactivity you need to support some eventing framework.  We will start with java Script.  Add the attribute Loaded="Page_Loaded"  to the base canvas element and the following script block:

<script type="text/javascript"> 
function Page_Loaded(){
alert("Loaded");
}

</script>

We could then extend the integration to other entry points of the control and embrace the full range of functionality in the Silverlight 1.0 framework.

Notepad is not the best tool for development and there are many more examples of tools for editing HTML and Javascript.  Microsoft produces some express tools that have this functionality and are freely available for download.  Microsoft's Expression Suite is also a good place to go to view some of our latest in design tools.

To take advantage of Silverlight 1.1 ability to host a subset of the .Net CLR functionality, we will have to compile assemblies and while this can be done with a command line interpreter, Visual C# Express edition is what I will use next.   I will also need to download and install the Silverlight 1.1 SDK.  This will provide me with the assemblies I will need in order to compile my project.

Start by launching C# Express and selecting File-New Project and select a Class Library Template.

image

Remove the auto generated class1.cs file and add three code files and Modify them as below:

SampleSL.xaml

<Canvas x:Name="parentCanvas"
        xmlns="http://schemas.microsoft.com/client/2007"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Loaded="Page_Loaded"
        x:Class="DemoSilverlight.SampleSL;assembly=bin/Release/DemoSilverlight.dll">
    <TextBlock x:Name="MyText" Text="This is the start"/>
</Canvas>

SampleSL.xaml.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Controls;

namespace DemoSilverlight
{
    public partial class SampleSL : Canvas
    {
        public void Page_Loaded(object o, EventArgs e)
        {
            Canvas can = o as Canvas;
            TextBlock txt = (TextBlock)can.FindName("MyText");
            txt.Text = "Hello from C#";
           
        }
    }
}

ShowMySilverlight.htm

<html>
    <object
           type="application/ag-plugin"
          id="myControl"
          width="400"
          height="100">
          <param name="background" value="Red" />
           <param name="source" value="SampleSL.xaml" />
     </object>
</html>

 

Remove all references in the project and then right click on the project file and select "Properties" and then "Build". 

 

image

 Click on the "Advanced.." button and check the setting to remove the automatic inclusion of mscorlib.dll during compile.

 

image

 Now go to the references section of the project and add the following references from the directory you installed the Silverlight SDK in (default=C:\Program Files\Microsoft Silverlight).

agclr.dll

mscorlib.dll

system.dll

system.core.dll

system.silverlight.dll

system.xml.core.dll

 

Compile the project and then view the html file in the browser.  You should see the SIlverlight 1.1 control and have an example of how to access xaml objects.

One thing to keep in mind is that in these examples I have avoided using the Silverlight.js helper file to instantiate the host objects to improve the clarity of what is happening.  Therefore these examples will only work in an IE browser.  If you would like to use firefox / safari   to view them, replace the object tag references with embed tag or use the helper file provided.  Details on this file can be found here.

Let me know if this helps

More Posts Next page »
 
Page view tracker