浏览代码

Add example to demonstrate portable library usage

danneesset 12 年之前
父节点
当前提交
de41263792

+ 95 - 0
Rx/NET/Samples/Portable/Net40ConsoleApplication/Net40ConsoleApplication.csproj

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Net40ConsoleApplication</RootNamespace>
+    <AssemblyName>Net40ConsoleApplication</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Reactive.Core">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Debugger">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Debugger.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Experimental">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Experimental.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Interfaces">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Interfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Linq">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Linq.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.PlatformServices">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.PlatformServices.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Providers">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Providers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Runtime.Remoting">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Runtime.Remoting.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Windows.Forms">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Windows.Forms.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Windows.Threading">
+      <HintPath>..\..\..\..\Layout\Rx\Debug40\System.Reactive.Windows.Threading.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\PortableClassLibrary\PortableClassLibrary.csproj">
+      <Project>{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}</Project>
+      <Name>PortableClassLibrary</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 46 - 0
Rx/NET/Samples/Portable/Net40ConsoleApplication/Program.cs

@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Reactive.Linq;
+
+namespace Net40ConsoleApplication
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+
+            var portableClass = new PortableClassLibrary.PortableClass();
+
+            var scheduler = System.Reactive.Concurrency.CurrentThreadScheduler.Instance;
+
+            // Create timer and route output to console
+            portableClass.CreateTimer(10, TimeSpan.FromSeconds(1.5))
+                .Buffer(2)
+                .ObserveOn(scheduler)
+                .Subscribe(items =>
+                {
+                    Console.WriteLine(" 1: Received items {0}", string.Join(", ", items));
+                }, onCompleted: () =>
+                {
+                    Console.WriteLine(" 1: Finished ");
+                });
+
+            // Create list observer and route output to console, but specify scheduler instead of using SubscribeOnDispatcher            
+            portableClass.CreateList(scheduler)
+                .Delay(TimeSpan.FromSeconds(1))
+                .Subscribe(item =>
+                {
+                    Console.WriteLine(" 2: Received item {0}", item);
+                }, onCompleted: () =>
+                {
+                    Console.WriteLine(" 2: Finished ");
+                });
+
+            
+            Console.WriteLine("Press enter to exit");
+            Console.ReadLine();
+        }
+    }
+}

+ 36 - 0
Rx/NET/Samples/Portable/Net40ConsoleApplication/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Net40ConsoleApplication")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Net40ConsoleApplication")]
+[assembly: AssemblyCopyright("Copyright ©  2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("15f46f39-53b0-438e-8dd5-10432d55f9bf")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 54 - 0
Rx/NET/Samples/Portable/Portable.sln

@@ -0,0 +1,54 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortableClassLibrary", "PortableClassLibrary\PortableClassLibrary.csproj", "{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Net40ConsoleApplication", "Net40ConsoleApplication\Net40ConsoleApplication.csproj", "{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightApplication", "SilverlightApplication\SilverlightApplication.csproj", "{50100DB6-3657-444B-B308-42A9FD1B283E}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|Mixed Platforms = Debug|Mixed Platforms
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|Mixed Platforms = Release|Mixed Platforms
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Release|Any CPU.Build.0 = Release|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}.Release|x86.ActiveCfg = Release|Any CPU
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Debug|Mixed Platforms.Build.0 = Debug|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Debug|x86.ActiveCfg = Debug|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Debug|x86.Build.0 = Debug|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Release|Any CPU.ActiveCfg = Release|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Release|Mixed Platforms.ActiveCfg = Release|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Release|Mixed Platforms.Build.0 = Release|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Release|x86.ActiveCfg = Release|x86
+		{CCCD13E5-63B9-43C7-93B7-71E6709CFDEC}.Release|x86.Build.0 = Release|x86
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{50100DB6-3657-444B-B308-42A9FD1B283E}.Release|x86.ActiveCfg = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 28 - 0
Rx/NET/Samples/Portable/PortableClassLibrary/PortableClass.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using System.Reactive;
+using System.Reactive.Linq;
+using System.Reactive.Concurrency;
+
+namespace PortableClassLibrary
+{
+    public class PortableClass
+    {
+        public IObservable<long> CreateTimer(int numSamples, TimeSpan timespan)
+        {
+            var fromTime = DateTimeOffset.Now.Add(timespan);
+            return Observable.Timer(fromTime, timespan)
+                    .Take(numSamples);
+        }
+
+        public IObservable<int> CreateList(IScheduler scheduler)
+        {
+            var values = new [] {1,2,5,7,8,324,4234,654654};
+
+            return values.ToObservable(scheduler);
+        }        
+    }
+}

+ 67 - 0
Rx/NET/Samples/Portable/PortableClassLibrary/PortableClassLibrary.csproj

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>PortableClassLibrary</RootNamespace>
+    <AssemblyName>PortableClassLibrary</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Profile2</TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="PortableClass.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="System.Reactive.Core">
+      <HintPath>..\..\..\..\Layout\Rx\DebugPLLITE\System.Reactive.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Debugger">
+      <HintPath>..\..\..\..\Layout\Rx\DebugPLLITE\System.Reactive.Debugger.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Experimental">
+      <HintPath>..\..\..\..\Layout\Rx\DebugPLLITE\System.Reactive.Experimental.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Interfaces">
+      <HintPath>..\..\..\..\Layout\Rx\DebugPLLITE\System.Reactive.Interfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Linq">
+      <HintPath>..\..\..\..\Layout\Rx\DebugPLLITE\System.Reactive.Linq.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Providers">
+      <HintPath>..\..\..\..\Layout\Rx\DebugPLLITE\System.Reactive.Providers.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 30 - 0
Rx/NET/Samples/Portable/PortableClassLibrary/Properties/AssemblyInfo.cs

@@ -0,0 +1,30 @@
+using System.Resources;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("PortableClassLibrary")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PortableClassLibrary")]
+[assembly: AssemblyCopyright("Copyright ©  2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 8 - 0
Rx/NET/Samples/Portable/SilverlightApplication/App.xaml

@@ -0,0 +1,8 @@
+<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
+             x:Class="SilverlightApplication.App"
+             >
+    <Application.Resources>
+        
+    </Application.Resources>
+</Application>

+ 68 - 0
Rx/NET/Samples/Portable/SilverlightApplication/App.xaml.cs

@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+
+namespace SilverlightApplication
+{
+    public partial class App : Application
+    {
+
+        public App()
+        {
+            this.Startup += this.Application_Startup;
+            this.Exit += this.Application_Exit;
+            this.UnhandledException += this.Application_UnhandledException;
+
+            InitializeComponent();
+        }
+
+        private void Application_Startup(object sender, StartupEventArgs e)
+        {
+            this.RootVisual = new MainPage();
+        }
+
+        private void Application_Exit(object sender, EventArgs e)
+        {
+
+        }
+
+        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+        {
+            // If the app is running outside of the debugger then report the exception using
+            // the browser's exception mechanism. On IE this will display it a yellow alert 
+            // icon in the status bar and Firefox will display a script error.
+            if (!System.Diagnostics.Debugger.IsAttached)
+            {
+
+                // NOTE: This will allow the application to continue running after an exception has been thrown
+                // but not handled. 
+                // For production applications this error handling should be replaced with something that will 
+                // report the error to the website and stop the application.
+                e.Handled = true;
+                Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
+            }
+        }
+
+        private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
+        {
+            try
+            {
+                string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
+                errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
+
+                System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
+            }
+            catch (Exception)
+            {
+            }
+        }
+    }
+}

+ 24 - 0
Rx/NET/Samples/Portable/SilverlightApplication/MainPage.xaml

@@ -0,0 +1,24 @@
+<UserControl x:Class="SilverlightApplication.MainPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d"
+    d:DesignHeight="300" d:DesignWidth="400">
+
+    <Grid x:Name="LayoutRoot" Background="White">
+    <Grid.RowDefinitions>
+      <RowDefinition Height="auto" />
+      <RowDefinition Height="*" />
+      <RowDefinition Height="auto" />
+      <RowDefinition Height="*" />
+    </Grid.RowDefinitions>
+
+    <TextBlock Text="Observable 1:" Grid.Row="0"/>
+    <ListBox x:Name="list1" Grid.Row="1" />
+
+    <TextBlock Text="Observable 2:" Grid.Row="2"/>
+    <ListBox x:Name="list2" Grid.Row="3" />
+
+  </Grid>
+</UserControl>

+ 58 - 0
Rx/NET/Samples/Portable/SilverlightApplication/MainPage.xaml.cs

@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using System.Reactive;
+using System.Reactive.Linq;
+
+namespace SilverlightApplication
+{
+    public partial class MainPage : UserControl
+    {
+        public MainPage()
+        {
+            InitializeComponent();
+            Loaded += new RoutedEventHandler(MainPage_Loaded);
+        }
+
+        void MainPage_Loaded(object sender, RoutedEventArgs e)
+        {
+            var portableClass = new PortableClassLibrary.PortableClass();
+
+            // Create timer and route output to list1
+            portableClass.CreateTimer(10, TimeSpan.FromSeconds(1.5))
+                .Buffer(2)
+                .ObserveOnDispatcher()
+                .Subscribe(items =>
+                {
+                    foreach (var item in items)
+                        list1.Items.Add(item);
+                }, onCompleted: () =>
+                {
+                    list1.Items.Add("Finished");
+                });
+
+            // Create list observer and route output to list1, but specify scheduler instead of using SubscribeOnDispatcher
+            var scheduler = System.Reactive.Concurrency.DispatcherScheduler.Current;
+            portableClass.CreateList(scheduler)
+                .Delay(TimeSpan.FromSeconds(1))
+                .ObserveOn(scheduler)
+                .Subscribe(item =>
+                {
+                    list2.Items.Add(item);
+                }, onCompleted: () =>
+                {
+                    list2.Items.Add("Finished");
+                });
+
+
+        }
+    }
+}

+ 6 - 0
Rx/NET/Samples/Portable/SilverlightApplication/Properties/AppManifest.xml

@@ -0,0 +1,6 @@
+<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+    <Deployment.Parts>
+    </Deployment.Parts>
+</Deployment>

+ 35 - 0
Rx/NET/Samples/Portable/SilverlightApplication/Properties/AssemblyInfo.cs

@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SilverlightApplication")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SilverlightApplication")]
+[assembly: AssemblyCopyright("Copyright ©  2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("768e8030-d2c8-42c2-8e2c-58b43809ce52")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 138 - 0
Rx/NET/Samples/Portable/SilverlightApplication/SilverlightApplication.csproj

@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{50100DB6-3657-444B-B308-42A9FD1B283E}</ProjectGuid>
+    <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>SilverlightApplication</RootNamespace>
+    <AssemblyName>SilverlightApplication</AssemblyName>
+    <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+    <SilverlightApplication>true</SilverlightApplication>
+    <SupportedCultures>
+    </SupportedCultures>
+    <XapOutputs>true</XapOutputs>
+    <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
+    <XapFilename>SilverlightApplication.xap</XapFilename>
+    <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
+    <SilverlightAppEntry>SilverlightApplication.App</SilverlightAppEntry>
+    <TestPageFileName>SilverlightApplicationTestPage.html</TestPageFileName>
+    <CreateTestPage>true</CreateTestPage>
+    <ValidateXaml>true</ValidateXaml>
+    <EnableOutOfBrowser>false</EnableOutOfBrowser>
+    <OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
+    <UsePlatformExtensions>false</UsePlatformExtensions>
+    <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+    <LinkedServerProject>
+    </LinkedServerProject>
+  </PropertyGroup>
+  <!-- This property group is only here to support building this project using the 
+       MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs 
+       to set the TargetFrameworkVersion to v3.5 -->
+  <PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Bin\Release</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System.Reactive.Core">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Debugger">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.Debugger.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Experimental">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.Experimental.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Interfaces">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.Interfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Linq">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.Linq.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.PlatformServices">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.PlatformServices.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Providers">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.Providers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reactive.Windows.Threading">
+      <HintPath>..\..\..\..\Layout\Rx\DebugSL4\System.Reactive.Windows.Threading.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Windows" />
+    <Reference Include="system" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Net" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Windows.Browser" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="MainPage.xaml.cs">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </ApplicationDefinition>
+    <Page Include="MainPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Properties\AppManifest.xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\PortableClassLibrary\PortableClassLibrary.csproj">
+      <Project>{24A63BF3-D9ED-4F4D-B576-E7A73AE00420}</Project>
+      <Name>PortableClassLibrary</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <ProjectExtensions>
+    <VisualStudio>
+      <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
+        <SilverlightProjectProperties />
+      </FlavorProperties>
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>