July 2, 2009

Creating NikeClone With Silverlight Part-1

Design, , , — by Peter Loebel

Introduction

NikeClone, this is the app I showed at MS Tech Day Dhaka. I’ve decided to explain this to the people who are interested to know how I created clone of the original Nike site. The reason is, I really liked the design of the Nike web site and amazed seeing how they did this with Flash. So I gave it a thought and realized same design can be applied with Silverlight and at the end it proved that it is quite easier to implement the design like this with Silverlight and it’s looking more flexible with Silverlight.

Starting The Project In Blend

I have used Expression Blend 3 Beta and Silverlight 3 Beta for this design. Open ExpressionBlend 3 if you have already installed it in your machine and Select New Project. This will bring up the following dialog box:

clip image001 thumb 0018D720 Creating NikeClone With Silverlight Part 1

more here

Silverlight 2.0 Authentication Services

Security, — by Peter Loebel

Message based authentication managed by Silverlight not the browser.

Silverlight can use the browsers cookies and send them to the hosts. When you authenticate with ASP.NET the authentication cookie stored to your computer will be used by Silverlight if you create a Silverlight Authentication Service

Create a service.svc make sure to select the Silverlight Service.

<%@ ServiceHost Language=”C#” Service=”System.Web.ApplicationServices.AuthenticationService %>

more here

Using Surface APIs in your WPF application

Oh to be the first kid in the neighborhood to get that new video game that the rest of your friends covet. What a sweet feeling to learn the secrets of the game, master the arcane moves and beat the game before everyone else. Once you’ve established yourself as the resident expert you’ll soon find your friends peppering you with a steady stream of questions on how to beat that grisly boss monster or solve that crafty last puzzle.

clip_image001[4]

To stretch the analogy a little; in Redmond that kid is Microsoft Surface and the game they been playing for the last couple years is called multi-touch. They were one of the first groups to work on multi-touch inside Microsoft and they built a set of APIs that brought the awesomeness of multi-touch to the big table. Now the rest of the Microsoft kids are clamoring for their knowledge.

more here

MVVM light toolkit (Silverlight edition) posted

Software, Tools, , , , — by Peter Loebel

To make development of WPF and Silverlight applications according to the Model-View-ViewModel pattern easier, I have put together a small toolkit which should speed up the creation of such applications by automating certain tasks.

The toolkit must be installed manually for now. My next task is to prepare an installer, which should allow installing everything automatically, and also checking for upgrades, upgrading automatically and uninstalling the toolkit. For now however, a little manual work must be done.

For more details about the MVVM light toolkit, check this initial blog post.

Also, a web page will be extended over the next few days, and everything will be announced in this blog, so stay tuned.

more here

Silverlight 2 unit test framework binaries updated

The Silverlight Unit Test Framework ships officially inside of the Silverlight Toolkit, since the team has a dependency on it for thousands and thousands of unit tests.

I recently did hear a few complaints that the Silverlight Unit Test Framework site on the MSDN Code Gallery is a little out of date. I hear you, and am going to try to refresh the wiki and documentation a little bit.

In the meantime, I’ve updated the site with the latest Silverlight 2 Unit Test Framework binaries for download. Here’s a direct link to the download. I don’t have any updated bits available for the Silverlight 3 Beta at this time.

What’s new in the July 2009 bits of the Silverlight Unit Test Framework?

more here

July 1, 2009

Eventing in Prism - Loosely Coupled Talking

Software, , , — by Peter Loebel

Prism allows us to have modular and loosely coupled applications, but how do these loosely coupled pieces communicate? That’s where Eventing and the EventAggregator come in: they provide communication channels. A way that the separate pieces of the application can safely talk back and forth. Eventing also has extra goodies (thread preference, weak references) that are built on the lessons learned from past technologies (like CAB). All around, it’s a great helper for any Silverlight/Prism (or WPF) application.
more here

Silverlight 3 Polling Duplex Chat and Realtime Stock Updates

By Peter Bromberg
Printer Friendly Version
View My Articles
Pete4120 Silverlight 3 Polling Duplex Chat and Realtime Stock Updates

An extension of the “End to End duplex sample” to show how Duplex polling can use the “push” model to send subscribed realtime stock price updates to connected clients.

I was asked to prototype something with the Duplex Polling feature of Silverlight 3 for some new Silverlight applications we’re working on for eggheadcafe.com. So, like any good developer, the first thing I did was set out not to have to reinvent the wheel. I found several good examples of duplex on the web, but the one that best suited my needs was the “Duplex End to End Sample”. This is a well-written simple chat service that also sends out a fake random stock price update using the “Push to all clients” model.

The stock update was interesting; I figured I could learn more about Silverlight duplex while at the same time turning this into something more realistic that could be tested with multiple clients to measure performance issues. So what I came up with was the idea that you could send a chat message, “subscribe MSFT” or “subscribe IBM”. The service would then store this in such a way that it would be able to retrieve realtime stock quotes, and then using the push model, it would send out the updates for each stock to every client who had “subscribed” to updates for that stock.  more here

Silverlight Mapping with DWQR – How’s my water quality?

Maps, tutorial, , , — by Peter Loebel

If you’re after an example of just how powerful Silverlight can be for online mapping scenarios look no further than:

http://www.dwqr.org.uk/map

A project we’ve recently completed for Drinking Water Quality Regulator for Scotland. This application sits within a redesign of their main public facing site with the intention of making the statistics that they collect much more visible and easy to access for the public. It also provides a useful tool for them to present at conferences and meetings.

What we did

The client supplied us with a shape file describing their regions and some CSV files containing the associated data. We imported these into a SQL Server 2008 database and wrote a server side ASP.NET application to expose the data via an API. The main bulk of the work when then writing a Silverlight mapping application to combine the regions and their data together over an interactive map of Scotland. Each region is clickable and when the user does so a panel is opened which displays the associated data over three tabs:

  1. Year to Date results, as a grid
  2. Last Years results, as a grid
  3. Results compared to National Average, as a chart (even has the DWQR logo as a background watermark!)

Here’s how things look when a zone is selected:

DWQR - Silverlight Mapping

more here

Handling Events within Silverlight Control Templates – AutoCompleteBox Example

One of the great features Silverlight offers is the ability to customize controls by using control templates.  If you don’t like how a particular control looks you can modify the template and in many cases be ready to use the new control without writing a single line of C# or VB code.  I’m working on a client application that uses the AutoCompleteBox found in the Silverlight Toolkit and needed a way to change it from a regular TextBox to more of an editable ComboBox.  Fortunately the Silverlight Toolkit samples (for Silverlight 2 and 3) already do something like this as you can see here (once on the page click on AutoCompleteBox to the left and then on the Styling tab at the top of the page to see the sample).

image thumb 718B1094 Handling Events within Silverlight Control Templates – AutoCompleteBox Example

The sample modifies the standard AutoCompleteBox to look more like an editable ComboBox by defining a custom control template with a ToggleButton in it (Tim Heuer provides a nice walk through of this type of customization here if you’re interested).  Here’s a simplified version of the Silverlight Toolkit’s sample template that I’m using:
more here

New MSDN Article on RIA Services Published

I saw Maurice de Beijer recently published a good introduction article on .NET RIA Services.  image thumb New MSDN Article on RIA Services Published

Getting started with the .NET RIA Services

The post starts with a very good introduction:

RIA, short for Rich Internet Applications, is a bit of an umbrella term for all sorts of applications delivered through the browser. The key aspect however is that they deliver some business function and are not just about flashy graphics. Business applications tend to work with data and other business resources so they are usually built in the standard N tier architecture. If we take a look at this N tier architecture for the most common type of business resource, the database, we typically see the Create, Read, Update, Delete, (CRUD) pattern appear all the time. While implementing the CRUD pattern in Silverlight isn’t extremely difficult the very fact that the Silverlight application runs in the browser without direct database access and all server communication is done asynchronously makes this harder than it needs to be. This is exactly one of the problems the .NET RIA Services is trying to solve. Of course there is more to the .NET RIA Services and the standard CRUD operations is just one of the issues addressed. As we will see in this article it addresses much more by including things like data validation, general communication, keeping client and server code synchronized and more.

from Brad Abrams

June 30, 2009

Game Programming with Silverlight

Games, , — by Peter Loebel

Tomorrow, June 30th, is the release date for my book titled “Game Programming with Silverlight“. Writing this book was a great experience as it was the first book I have ever written. It was extremely time consuming mostly because it was a learning experience but I am glad I did it.

Also, I apologize for the lack of Silverlight tips these days! Finishing the book was my top priority but I am looking forward to getting back to adding Silverlight tips on a regular basis.

The book itself covers a lot of what I discuss here in this tips blog but with more detail. Here is a quick outline of what I covered in the book:

Chapter 1: Silverlight 101. I start the book off by giving a thorough introduction into Silverlight, XAML and Silverlight controls.

Chapter 2: Getting Started. This chapter covers using Visual Studio 2008 and 2010 for creating Silverlight projects.

Chapter 3: What’s new with Silverlight 3. I cover each and every new feature to Silverlight 3 that could pertain to game development.

Chapter 4: Silverlight Tips and Tricks. Mostly tips I covered here in my blog.

more here

June 29, 2009

Sahil Malik on Silverlight in Sharepoint

tutorial, — by Peter Loebel

Our good friend Sahil Malik returns to the dnrTV screen this week to show us how to easily incorporate Silverlight in your sharepoint site.

watchAG Sahil Malik on Silverlight in SharepointdownHTTP Sahil Malik on Silverlight in SharepointdownTorrent Sahil Malik on Silverlight in SharepointsubHTTP Sahil Malik on Silverlight in SharepointsubTorrent Sahil Malik on Silverlight in Sharepoint
Sahil Malik Sahil Malik is a .NET author, trainer and consultant who has worked in Microsoft Technologies since the DOS days. Currently he is heavily invested in Shar

more here

YouTube video in Silverlight 3

A while back I saw a post titled something like Displaying YouTube Videos in Silverlight.  The implementation included a Windowless Silverlight application with a Flash video player on top.  Video controls were implemented in Silverlight, and were wired up with JavaScript.

YouTube is moving toward the h.264 encoding for their videos.  (My guess is to prepare for HTML 5.  It’s crazy to think that YouTube could/might move away from Flash.)  Silverlight 3 is a benefactor because it can support h.264.  If anyone is looking for a great mashup, make a Silverlight video player that integrates with the YouTube API.

To be explicit, this post is not about using the YouTube API; it is a proof of concept.  I used the YouTube HD Ultimate Greasemonkey script to get the url of an HD video from YouTube, then used it as the source for the MediaElement.

image10 YouTube video in Silverlight 3

more here

June 28, 2009

A Mouse Wheel Blend Behavior

by Nigel Sampson

One fairly useful piece of functionality missing from Silverlight is the use of the Mouse Wheel, thankfully there’s a lot of code out there about how to use the Html Bridge to receive DOM events and bring in Mouse Wheel functionality.

The trouble is that with these examples you need to wire up all the events and manually deal with the mouse wheel.

Silverlight / Blend Behaviors can help with this quite a bit by encapsulating all the required functionality in a simple drag and drop component.

As I’ve discussed before Blend Behaviors come in three flavors, Triggers, Actions and Behaviors. Triggers and Actions are great when you want to have both the action and trigger asseparate composable items but sometimes both the trigger and action are so intertwined that it doesn’t make sense for them to be separated, this is where Behaviors come in, they really are pre-packaged pieces of functionality.

more here

Bing vs Google: Microsoft Gets Serious About Search

Basics, , , — by Peter Loebel

Even my 90 year old Grand Mother is aware that Microsoft have dominated software products. But where have they been in search? Microsoft Live Search handled about 9 or 10% of searches but that pales in comparison to Googles 60% and Yahoo! at over 20% of searches. But perhaps now, finally, Microsoft is getting serious about search with Bing.

Bing is a stark home page focusing solely on search, as Google does, and not a larger portal style home page like Yahoo! Many thought this might not be the case as they could easily have built a portal, but many are excited by the bold move to focus on search. Bing 226 Bing vs Google: Microsoft Gets Serious About Search

more here