What's different about the 3 versions of Rx? Part 1: Silverlight 3
- Posted: Nov 17, 2009 at 12:22 PM
- 6,013 Views
- 1 Comment
Download
How do I download the videos?
- To download, right click the file type you would like and pick “Save target as…” or “Save link as…”
Why should I download videos from Channel9?
- It's an easy way to save the videos you like locally.
- You can save the videos in order to watch them offline.
- If all you want is to hear the audio, you can download the MP3!
Which version should I choose?
- If you want to view the video on your PC, Xbox or Media Center, download the High Quality WMV file (this is the highest quality version we have available).
- If you'd like a lower bitrate version, to reduce the download time or cost, then choose the Medium Quality WMV file.
- If you have a Zune, WP7, iPhone, iPad, or iPod device, choose the low or medium MP4 file.
- If you just want to hear the audio of the video, choose the MP3 file.
Right click “Save as…”
- High Quality WMV (PC, Xbox, MCE)
- MP3 (Audio only)
- MP4 (iPod, Zune HD)
- Mid Quality WMV (Lo-band, Mobile)
Today we released Reactive Extensions for .NET 3.5 SP1, Silverlight 3 and .NET 4 Beta 2. In this 3 part video, I'll go over the small differences in each of the three releases.
This first video will focus on Silverlight 3.
This first video will focus on Silverlight 3.
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
For the March 2010 version of Rx, the code needs to be adjusted as follows:
Observable.Start(() =>
{
Thread.Sleep(3000);
//return "Hello World";
}).ObserveOnDispatcher().Subscribe(_ => button.Content = "Hello World");
Note the addition of ObserveOnDispatcher above as compared to its absence in the video.
Lastly, the original code:
ThreadPool.QueueUserWorkItem(_ =>
{
Thread.Sleep(3000);
button.Dispatcher.BeginInvoke(() =>
{
button.Content = "Hello World!";
});
}, null);
Is quite terse as well. Compared to my revised version, I'm not sure the character count is all that different.
Nice Rx sample. Qualifies as the "Hello World!" of Rx for Silverlight and other ilks ... here's a console app version:
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Creating ...");
var o = Observable.Start(() =>
{
Console.WriteLine("Calculating...");
Thread.Sleep(3000);
}).Subscribe(_ => Console.WriteLine("Hello World!"));
Console.WriteLine("Created ...");
Console.WriteLine("Starting ...");
Console.ReadKey();
}
}
}
For WPF its:
<!-- Window1.xaml -->
<Window x:Class="HelloWorld.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Button x:Name="button" Margin="63,47,77,0" VerticalAlignment="Top" Height="60" Content="Button"/>
</Grid>
</Window>
// Window1.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Threading;
namespace HelloWorld
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
button.Click += (o, e) =>
{
// button.Content = "Hello World";
Observable.Start(() =>
{
Thread.Sleep(3000);
}).ObserveOnDispatcher().Subscribe(_ => button.Content = "Hello World!");
};
}
}
}
All very similar. Now all we need is the Winforms variations.
Remove this comment
Remove this thread
close