ScottGu Mix Keynote coding demo posted
A ton of folks have asked us about getting the source code to Scott’s cool coding demo.
download the completed example code
Note, there are a couple of prereqs:
- Sql Server 2008 to run it.. works great with the free Sql Express 2008
- .NET RIA Services March '09 Preview
- 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.
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.
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.
Comments
Anonymous
April 26, 2009
The link to Scott's video demo does not seem to be working ??Anonymous
April 26, 2009
thanks... i fixed it.Anonymous
April 27, 2009
Thank you for submitting this cool story - Trackback from DotNetShoutoutAnonymous
April 27, 2009
In this Issue: Maurice de Beijer , Ruurd Boeke , Shawn Wildermuth , and Michael Wolf . Shoutouts: BradAnonymous
April 27, 2009
都是Silverlight做的游戏 http://www.silverarcade.com/GamesAnonymous
April 28, 2009
The comment has been removedAnonymous
April 28, 2009
A ton of folks have asked us about getting the source code to Scott’s cool coding demo. Watch the demoAnonymous
April 30, 2009
Thanks again to Marc Schweigert for hosting last night’s DevDinner in Reston. My blog is at www.irritatedVowel.com/BlogAnonymous
June 07, 2009
I have previously written about the UNPLUGGED road trip that Mike , Nathan and I have been on. I alsoAnonymous
July 13, 2009
話題の小向美奈子ストリップを盗撮!入念なボディチェックをすり抜けて超小型カメラで撮影した神動画がアップ中!期間限定配信の衝撃的映像を見逃すなAnonymous
July 14, 2009
The comment has been removedAnonymous
July 15, 2009
mixiで禁止された「出会い」コミュニティーが復活しているのをご存じですか?当サイトでは規制前の楽しかった頃のミクシーを再現しているという好評を頂いております。会員数も右肩上がりに増えていますので、興味のある方はぜひご覧くださいAnonymous
July 16, 2009
癒されたい女性や、寂しい素人女性を心も体も癒してあげるお仕事をご存じですか?女性宅やホテルに行って依頼主の女性とHしてあげるだけで高額の謝礼を手に入れる事が出来るのです。興味のある方は当サイトTOPページをご覧くださいAnonymous
July 17, 2009
The comment has been removedAnonymous
July 17, 2009
女性向け風俗サイトで出張デリバリーホストをしてみませんか?時給2万円以上の超高額アルバイトです。無料登録をしてあとは女性からの呼び出しを待つだけなので、お試し登録も歓迎です。興味をもたれた方は今すぐどうぞ。Anonymous
July 19, 2009
最近TVや雑誌で紹介されている家出掲示板では、全国各地のネットカフェ等を泊り歩いている家出娘のメッセージが多数書き込みされています。彼女たちはお金がないので掲示板で知り合った男性の家にでもすぐに泊まりに行くようです。あなたも書き込みに返事を返してみませんかAnonymous
July 20, 2009
あなたの性格を、動物に例えて占っちゃいます。もしかしたらこんな動物かも!?動物占いをうまく使って、楽しい人間関係を築いてくださいAnonymous
July 21, 2009
The comment has been removedAnonymous
July 22, 2009
家出中の女性や泊まる所が無い女性達がネットカフェなどで、飲み放題のドリンクで空腹を満たす生活を送っています。当サイトはそんな女性達をサポートしたいという人たちと困っている女性たちの為のサイトです