Amazon.com Widgets

ScottGu Mix Keynote coding demo posted

A ton of folks have asked us about getting the source code to Scott’s cool coding demo. 

image

 Watch the demo

download the completed example code

Note, there are a couple of prereqs:

  1. Sql Server 2008 to run it.. works great with the free Sql Express 2008
  2. .NET RIA Services March '09 Preview
  3. Silverlight 3 Beta

Enjoy!

Complete demo steps:

1. In Views/CustomersPage.xaml.cs, in OnNavigatedTo(), add the following:

var context = new CustomersDomainContext(); 
customersList.ItemsSource = context.Customers; 
context.LoadCustomers();

This code loads the data from the DomainService class on the server.  Notice the data is loaded asynchronously, but no ugly, hard to debug async code is needed. 

2. In CustomerDetailsPage.xaml.cs OnNavigatedTo, add this code:

this.DataContext = context; 
int customerID = int.Parse(NavigationContext.QueryString["CustomerID"]); 
context.LoadCustomerOrders(customerID);
 
This code grabs the Customer id off the query string and loads it up.. effectively a detailsview.

3. F5 the app, click on one of the customers.
clip_image002
clip_image004

4. Then sign up for the SaveButton Click event (last line in the following XAML snippet):

<Button x:Name="SaveButton" 
Style="{StaticResource SaveButtonStyle}" 
Click="SaveButton_Click"/>

5. In the code-behind CustomerDetailsPage.xaml.cs, add the following code to the newly-created event handler:

private void SaveButton_Click(object sender, RoutedEventArgs e) 
{ 
    context.SubmitChanges(); 
}

Notice how simple it is to save all your pending changes back to the server.  The client has kept up with what has changed and sends back a smart diff-gram.

6. Ctrl+F5 the app , go back to the details page, now try editing the phone number and see how it’s validated nicely. Note that this validation occurs both client-side and server-side.
clip_image006

7. Click one of the items in the DataGrid, show how the chart updates. Select something in another group in the DataGrid and show cool chart animation.

8. Click “Save” to save data in the DataForm back to the database.

Published 23 April 09 10:56 by BradA
Filed under:

Comments

# Steve said on April 27, 2009 12:31 AM:

The link to Scott's video demo does not seem to be working ??

# BradA said on April 27, 2009 1:42 AM:

thanks... i fixed it.

# DotNetShoutout said on April 27, 2009 9:54 AM:

Thank you for submitting this cool story - Trackback from DotNetShoutout

# Community Blogs said on April 27, 2009 7:13 PM:

In this Issue: Maurice de Beijer , Ruurd Boeke , Shawn Wildermuth , and Michael Wolf . Shoutouts: Brad

# nasa said on April 28, 2009 4:37 AM:

都是Silverlight做的游戏

http://www.silverarcade.com/Games

# DotNetBurner - Silverlight said on April 28, 2009 8:11 AM:

DotNetBurner - burning hot .net content

# What's New said on April 28, 2009 11:48 AM:

A ton of folks have asked us about getting the source code to Scott’s cool coding demo. Watch the demo

# POKE 53280,0: Pete Brown's Blog said on April 30, 2009 11:49 AM:

Thanks again to Marc Schweigert for hosting last night’s DevDinner in Reston. My blog is at www.irritatedVowel.com/Blog

# Nigel Parker's Outside Line said on June 7, 2009 5:37 PM:

I have previously written about the UNPLUGGED road trip that Mike , Nathan and I have been on. I also

# 小向美奈子 said on July 13, 2009 11:38 AM:

話題の小向美奈子ストリップを盗撮!入念なボディチェックをすり抜けて超小型カメラで撮影した神動画がアップ中!期間限定配信の衝撃的映像を見逃すな

# 高額報酬 said on July 14, 2009 10:28 AM:

当サイトではリッチなセレブと割り切りでお付き合いしてくださる男性を募集しています。女性の性欲を満たし、高額報酬をもらって楽しく暮らしてみませんか?興味がある方はバイト感覚での1日登録もできる、安心の無料入会を今すぐどうぞ。

# mixi said on July 15, 2009 11:08 AM:

mixiで禁止された「出会い」コミュニティーが復活しているのをご存じですか?当サイトでは規制前の楽しかった頃のミクシーを再現しているという好評を頂いております。会員数も右肩上がりに増えていますので、興味のある方はぜひご覧ください

# 素人 said on July 16, 2009 11:02 AM:

癒されたい女性や、寂しい素人女性を心も体も癒してあげるお仕事をご存じですか?女性宅やホテルに行って依頼主の女性とHしてあげるだけで高額の謝礼を手に入れる事が出来るのです。興味のある方は当サイトTOPページをご覧ください

# メル友募集 said on July 17, 2009 10:51 AM:

最近してないし欲求不満です。一緒にいやらしいことしませんか?エッチには自信あるよ(笑) nyaon.chuki@docomo.ne.jp メール待ってるよ☆

# ホスト said on July 18, 2009 6:00 AM:

女性向け風俗サイトで出張デリバリーホストをしてみませんか?時給2万円以上の超高額アルバイトです。無料登録をしてあとは女性からの呼び出しを待つだけなので、お試し登録も歓迎です。興味をもたれた方は今すぐどうぞ。

# 家出 said on July 19, 2009 9:56 AM:

最近TVや雑誌で紹介されている家出掲示板では、全国各地のネットカフェ等を泊り歩いている家出娘のメッセージが多数書き込みされています。彼女たちはお金がないので掲示板で知り合った男性の家にでもすぐに泊まりに行くようです。あなたも書き込みに返事を返してみませんか

# 動物占い said on July 20, 2009 10:08 AM:

あなたの性格を、動物に例えて占っちゃいます。もしかしたらこんな動物かも!?動物占いをうまく使って、楽しい人間関係を築いてください

# 救援部 said on July 21, 2009 9:37 AM:

当サイト、救援部では無料でオ○ニー動画を見ることができます。ご近所検索機能でリアルタイムオ○ニーを見るチャンスも高く、興奮間違いなしです。また、一人Hのお手伝いを希望されるセレブ女性もあり、お手伝いいただけた方には高額謝礼をお支払いしております。

# 家出 said on July 22, 2009 9:29 AM:

家出中の女性や泊まる所が無い女性達がネットカフェなどで、飲み放題のドリンクで空腹を満たす生活を送っています。当サイトはそんな女性達をサポートしたいという人たちと困っている女性たちの為のサイトです

New Comments to this post are disabled

Search

This Blog

Syndication

Page view tracker