Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Rx/NET/Samples/RxRemoteMouseMoves')
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Core.dllbin0 -> 88056 bytes
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Interfaces.dllbin0 -> 23544 bytes
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Linq.dllbin0 -> 696824 bytes
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.PlatformServices.dllbin0 -> 35824 bytes
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Runtime.Remoting.dllbin0 -> 25080 bytes
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Windows.Forms.dllbin0 -> 25592 bytes
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Msmq.cs51
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Remoting.cs41
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.cs54
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Properties/AssemblyInfo.cs36
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/RxMouseClient.csproj96
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/app.config3
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/MouseService.cs62
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Msmq.cs80
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Remoting.cs42
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.cs50
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Properties/AssemblyInfo.cs36
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/RxMouseServer.csproj97
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/app.config3
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/MouseService.cs10
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/Properties/AssemblyInfo.cs36
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/RxMouseService.csproj54
-rw-r--r--Rx/NET/Samples/RxRemoteMouseMoves/RxRemoteMouseMoves.sln69
23 files changed, 820 insertions, 0 deletions
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Core.dll b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Core.dll
new file mode 100644
index 0000000..aecf41e
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Core.dll
Binary files differ
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Interfaces.dll b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Interfaces.dll
new file mode 100644
index 0000000..47aa9d1
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Interfaces.dll
Binary files differ
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Linq.dll b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Linq.dll
new file mode 100644
index 0000000..5c56946
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Linq.dll
Binary files differ
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.PlatformServices.dll b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.PlatformServices.dll
new file mode 100644
index 0000000..b1413d0
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.PlatformServices.dll
Binary files differ
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Runtime.Remoting.dll b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Runtime.Remoting.dll
new file mode 100644
index 0000000..8b3b3e3
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Runtime.Remoting.dll
Binary files differ
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Windows.Forms.dll b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Windows.Forms.dll
new file mode 100644
index 0000000..0f4dcac
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/References/System.Reactive.Windows.Forms.dll
Binary files differ
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Msmq.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Msmq.cs
new file mode 100644
index 0000000..90c2ca0
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Msmq.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Drawing;
+using System.Messaging;
+using System.Reactive.Concurrency;
+using System.Reactive.Disposables;
+using System.Reactive.Linq;
+
+namespace RxMouseClient
+{
+ partial class Program
+ {
+ static IObservable<Point> Msmq(string srv)
+ {
+ return FromQueue<Point>(srv + "\\Private$\\MouseService");
+ }
+
+ static IObservable<T> FromQueue<T>(string serverQueue)
+ {
+ return Observable.Create<T>(observer =>
+ {
+ var responseQueue = Environment.MachineName + "\\Private$\\" + Guid.NewGuid().ToString();
+ var queue = MessageQueue.Create(responseQueue);
+
+ var frm = new System.Messaging.BinaryMessageFormatter();
+ var srv = new MessageQueue(serverQueue);
+ srv.Formatter = frm;
+ queue.Formatter = frm;
+
+ srv.Send("S " + responseQueue);
+
+ var loop = NewThreadScheduler.Default.ScheduleLongRunning(cancel =>
+ {
+ while (!cancel.IsDisposed)
+ {
+ var msg = queue.Receive();
+ observer.OnNext((T)msg.Body);
+ }
+ });
+
+ return new CompositeDisposable(
+ loop,
+ Disposable.Create(() =>
+ {
+ srv.Send("D " + responseQueue);
+ MessageQueue.Delete(responseQueue);
+ })
+ );
+ });
+ }
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Remoting.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Remoting.cs
new file mode 100644
index 0000000..fc5e68d
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.Remoting.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Reactive.Linq;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using System.Runtime.Serialization.Formatters;
+using System.Windows.Forms;
+using RxMouseService;
+
+namespace RxMouseClient
+{
+ partial class Program
+ {
+ const string SERVICENAME = "MouseService";
+
+ static IObservable<Point> Remoting(string srv, int port)
+ {
+ ConfigureRemoting();
+
+ var ms = (IMouseService)Activator.GetObject(typeof(IMouseService), string.Format("tcp://{0}:{1}/{2}", srv, port, SERVICENAME));
+
+ return ms.GetPoints();
+ }
+
+ private static void ConfigureRemoting()
+ {
+ var server = new BinaryServerFormatterSinkProvider();
+ server.TypeFilterLevel = TypeFilterLevel.Full;
+
+ var client = new BinaryClientFormatterSinkProvider();
+
+ IDictionary props = new Hashtable();
+ props["port"] = 0;
+ props["name"] = SERVICENAME;
+ props["typeFilterLevel"] = TypeFilterLevel.Full;
+
+ ChannelServices.RegisterChannel(new TcpChannel(props, client, null), false);
+ }
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.cs
new file mode 100644
index 0000000..616fc06
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Program.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Drawing;
+using System.Reactive.Linq;
+using System.Windows.Forms;
+
+namespace RxMouseClient
+{
+ partial class Program
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Client");
+
+ string server;
+ int port;
+ ParseArgs(args, out server, out port);
+
+ var points = Remoting(server, port);
+
+ var frm = new Form();
+
+ var closed = Observable.FromEventPattern(frm, "FormClosed");
+
+ frm.Load += (o, e) =>
+ {
+ var g = frm.CreateGraphics();
+
+ points.TakeUntil(closed).ObserveOn(frm).Subscribe(pt =>
+ {
+ g.DrawEllipse(Pens.Red, pt.X, pt.Y, 1, 1);
+ });
+ };
+
+ Application.Run(frm);
+ }
+
+ static void ParseArgs(string[] args, out string server, out int port)
+ {
+ port = 9090;
+ server = "localhost";
+
+ if (args.Length >= 1)
+ {
+ server = args[0];
+
+ if (args.Length == 2)
+ {
+ port = int.Parse(args[1]);
+ }
+ }
+ }
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Properties/AssemblyInfo.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..38221c0
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/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("RxMouseClient")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("MSIT")]
+[assembly: AssemblyProduct("RxMouseClient")]
+[assembly: AssemblyCopyright("Copyright © MSIT 2012")]
+[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("6f17287e-17c3-4160-93b8-dbd420201dbd")]
+
+// 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")]
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/RxMouseClient.csproj b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/RxMouseClient.csproj
new file mode 100644
index 0000000..2fc09e5
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/RxMouseClient.csproj
@@ -0,0 +1,96 @@
+<?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>{5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RxMouseClient</RootNamespace>
+ <AssemblyName>RxMouseClient</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ <SccProjectName>SAK</SccProjectName>
+ <SccLocalPath>SAK</SccLocalPath>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccProvider>SAK</SccProvider>
+ </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.Drawing" />
+ <Reference Include="System.Messaging" />
+ <Reference Include="System.Reactive.Core, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Interfaces, Version=2.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Linq, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Linq.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.PlatformServices, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.PlatformServices.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Runtime.Remoting, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Runtime.Remoting.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Windows.Forms, Version=1.0.10621.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Windows.Forms.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Runtime.Remoting" />
+ <Reference Include="System.Windows.Forms" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.Msmq.cs" />
+ <Compile Include="Program.Remoting.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\RxMouseService\RxMouseService.csproj">
+ <Project>{E1C1D499-15ED-454A-AE34-35F62E53250C}</Project>
+ <Name>RxMouseService</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ </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> \ No newline at end of file
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/app.config b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/app.config
new file mode 100644
index 0000000..e365603
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseClient/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/MouseService.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/MouseService.cs
new file mode 100644
index 0000000..52fe733
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/MouseService.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Drawing;
+using System.Reactive.Concurrency;
+using System.Reactive.Disposables;
+using System.Reactive.Linq;
+using System.Reactive.Subjects;
+using RxMouseService;
+
+namespace RxMouseServer
+{
+ public class MouseService : MarshalByRefObject, IMouseService, IObserver<Point>
+ {
+ private ReplaySubject<Point> _points;
+
+ public MouseService()
+ {
+ _points = new ReplaySubject<Point>();
+ }
+
+ public IObservable<Point> GetPoints()
+ {
+ var src = _points.ObserveOn(NewThreadScheduler.Default);
+ return Log(src).Remotable();
+ }
+
+ public IObservable<T> Log<T>(IObservable<T> source)
+ {
+ return Observable.Create<T>(observer =>
+ {
+ Console.WriteLine("Client connected!");
+
+ var d = source.Subscribe(observer);
+
+ return Disposable.Create(() =>
+ {
+ Console.WriteLine("Client disconnected!");
+ d.Dispose();
+ });
+ });
+ }
+
+ public void OnNext(Point value)
+ {
+ _points.OnNext(value);
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Msmq.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Msmq.cs
new file mode 100644
index 0000000..dae8905
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Msmq.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Messaging;
+using System.Reactive.Concurrency;
+using System.Reactive.Linq;
+using System.Reactive.Subjects;
+
+namespace RxMouseServer
+{
+ partial class Program
+ {
+ static IObserver<Point> Msmq()
+ {
+ var q = "BARTDE-M6500\\Private$\\MouseService";
+ var queue = default(MessageQueue);
+ if (MessageQueue.Exists(q))
+ {
+ queue = new MessageQueue(q);
+ }
+ else
+ {
+ queue = MessageQueue.Create(q);
+ }
+
+ var format = new System.Messaging.BinaryMessageFormatter();
+ queue.Formatter = format;
+
+ var incoming = Observable.Create<string>(observer =>
+ {
+ return NewThreadScheduler.Default.ScheduleLongRunning(cancel =>
+ {
+ while (!cancel.IsDisposed)
+ {
+ var msg = queue.Receive();
+ observer.OnNext((string)msg.Body);
+ }
+ });
+ });
+
+ var sub = new ReplaySubject<Point>();
+
+ var map = new Dictionary<string, IDisposable>();
+
+ incoming.Subscribe(clientQueue =>
+ {
+ var command = clientQueue[0];
+ var target = clientQueue.Substring(2);
+
+ switch (command)
+ {
+ case 'S':
+ {
+ var cq = new MessageQueue(target);
+
+ var crm = new System.Messaging.BinaryMessageFormatter();
+ cq.Formatter = crm;
+
+ map[target] = sub.Subscribe(pt =>
+ {
+ cq.Send(pt);
+ });
+ }
+ break;
+ case 'D':
+ {
+ var d = default(IDisposable);
+ if (map.TryGetValue(target, out d))
+ d.Dispose();
+ }
+ break;
+ default:
+ throw new Exception("Don't know what you're talking about!");
+ }
+ });
+
+ return sub;
+ }
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Remoting.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Remoting.cs
new file mode 100644
index 0000000..2abc7d3
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.Remoting.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using System.Runtime.Serialization.Formatters;
+using RxMouseService;
+
+namespace RxMouseServer
+{
+ partial class Program
+ {
+ const string SERVICENAME = "MouseService";
+
+ static IObserver<Point> Remoting(int port)
+ {
+ ConfigureRemoting(port);
+
+ RemotingConfiguration.RegisterWellKnownServiceType(typeof(MouseService), SERVICENAME, WellKnownObjectMode.Singleton);
+
+ var ms = (IMouseService)Activator.GetObject(typeof(IMouseService), string.Format("tcp://{0}:{1}/{2}", "localhost", port, SERVICENAME));
+
+ return (IObserver<Point>)ms;
+ }
+
+ private static void ConfigureRemoting(int port)
+ {
+ var serverProvider = new BinaryServerFormatterSinkProvider();
+ serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
+
+ var clientProvider = new BinaryClientFormatterSinkProvider();
+
+ IDictionary props = new Hashtable();
+ props["port"] = port;
+ props["name"] = SERVICENAME;
+ props["typeFilterLevel"] = TypeFilterLevel.Full;
+
+ ChannelServices.RegisterChannel(new TcpChannel(props, clientProvider, serverProvider), false);
+ }
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.cs
new file mode 100644
index 0000000..fe4ac77
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Program.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Drawing;
+using System.Reactive.Linq;
+using System.Windows.Forms;
+
+namespace RxMouseServer
+{
+ partial class Program
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Server");
+
+ int port;
+ ParseArgs(args, out port);
+
+ var observer = Remoting(port);
+
+ var frm = new Form();
+
+ frm.Load += (o, e) =>
+ {
+ var g = frm.CreateGraphics();
+
+ var mme = (from mm in Observable.FromEventPattern<MouseEventArgs>(frm, "MouseMove")
+ select mm.EventArgs.Location)
+ .DistinctUntilChanged()
+ .Do(pt =>
+ {
+ g.DrawEllipse(Pens.Red, pt.X, pt.Y, 1, 1);
+ });
+
+ mme.Subscribe(observer);
+ };
+
+ Application.Run(frm);
+ }
+
+ static void ParseArgs(string[] args, out int port)
+ {
+ port = 9090;
+
+ if (args.Length == 1)
+ {
+ port = int.Parse(args[0]);
+ }
+ }
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Properties/AssemblyInfo.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..3d7fc18
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/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("RxMouseServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("MSIT")]
+[assembly: AssemblyProduct("RxMouseServer")]
+[assembly: AssemblyCopyright("Copyright © MSIT 2012")]
+[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("1befbebc-d301-4b64-bb2e-522608dc8927")]
+
+// 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")]
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/RxMouseServer.csproj b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/RxMouseServer.csproj
new file mode 100644
index 0000000..79950fd
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/RxMouseServer.csproj
@@ -0,0 +1,97 @@
+<?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>{52568D5F-7C8A-49FE-A28D-119C7CBCC71D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RxMouseServer</RootNamespace>
+ <AssemblyName>RxMouseServer</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ <SccProjectName>SAK</SccProjectName>
+ <SccLocalPath>SAK</SccLocalPath>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccProvider>SAK</SccProvider>
+ </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.Drawing" />
+ <Reference Include="System.Messaging" />
+ <Reference Include="System.Reactive.Core, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Interfaces, Version=2.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Linq, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Linq.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.PlatformServices, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.PlatformServices.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Runtime.Remoting, Version=2.0.20527.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Runtime.Remoting.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Windows.Forms, Version=1.0.10621.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\System.Reactive.Windows.Forms.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Runtime.Remoting" />
+ <Reference Include="System.Windows.Forms" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.Msmq.cs" />
+ <Compile Include="Program.Remoting.cs" />
+ <Compile Include="MouseService.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\RxMouseService\RxMouseService.csproj">
+ <Project>{E1C1D499-15ED-454A-AE34-35F62E53250C}</Project>
+ <Name>RxMouseService</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ </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> \ No newline at end of file
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/app.config b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/app.config
new file mode 100644
index 0000000..e365603
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseServer/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/MouseService.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/MouseService.cs
new file mode 100644
index 0000000..550d93f
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/MouseService.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Drawing;
+
+namespace RxMouseService
+{
+ public interface IMouseService
+ {
+ IObservable<Point> GetPoints();
+ }
+}
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/Properties/AssemblyInfo.cs b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..9f2902d
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/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("RxMouseService")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("MSIT")]
+[assembly: AssemblyProduct("RxMouseService")]
+[assembly: AssemblyCopyright("Copyright © MSIT 2012")]
+[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("0442c61a-2690-424a-bf06-38dc3d562014")]
+
+// 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")]
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/RxMouseService.csproj b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/RxMouseService.csproj
new file mode 100644
index 0000000..0549ff2
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxMouseService/RxMouseService.csproj
@@ -0,0 +1,54 @@
+<?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.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E1C1D499-15ED-454A-AE34-35F62E53250C}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RxMouseService</RootNamespace>
+ <AssemblyName>RxMouseService</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <SccProjectName>SAK</SccProjectName>
+ <SccLocalPath>SAK</SccLocalPath>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccProvider>SAK</SccProvider>
+ </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>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Drawing" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MouseService.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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> \ No newline at end of file
diff --git a/Rx/NET/Samples/RxRemoteMouseMoves/RxRemoteMouseMoves.sln b/Rx/NET/Samples/RxRemoteMouseMoves/RxRemoteMouseMoves.sln
new file mode 100644
index 0000000..8f747aa
--- /dev/null
+++ b/Rx/NET/Samples/RxRemoteMouseMoves/RxRemoteMouseMoves.sln
@@ -0,0 +1,69 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RxMouseServer", "RxMouseServer\RxMouseServer.csproj", "{52568D5F-7C8A-49FE-A28D-119C7CBCC71D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RxMouseClient", "RxMouseClient\RxMouseClient.csproj", "{5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RxMouseService", "RxMouseService\RxMouseService.csproj", "{E1C1D499-15ED-454A-AE34-35F62E53250C}"
+EndProject
+Global
+ GlobalSection(TeamFoundationVersionControl) = preSolution
+ SccNumberOfProjects = 4
+ SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+ SccTeamFoundationServer = http://vstfpg04:8080/tfs/pg04
+ SccLocalPath0 = .
+ SccProjectUniqueName1 = RxMouseClient\\RxMouseClient.csproj
+ SccProjectName1 = RxMouseClient
+ SccLocalPath1 = RxMouseClient
+ SccProjectUniqueName2 = RxMouseServer\\RxMouseServer.csproj
+ SccProjectName2 = RxMouseServer
+ SccLocalPath2 = RxMouseServer
+ SccProjectUniqueName3 = RxMouseService\\RxMouseService.csproj
+ SccProjectName3 = RxMouseService
+ SccLocalPath3 = RxMouseService
+ EndGlobalSection
+ 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
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Debug|x86.ActiveCfg = Debug|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Debug|x86.Build.0 = Debug|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Release|Any CPU.ActiveCfg = Release|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Release|Mixed Platforms.Build.0 = Release|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Release|x86.ActiveCfg = Release|x86
+ {52568D5F-7C8A-49FE-A28D-119C7CBCC71D}.Release|x86.Build.0 = Release|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Debug|x86.ActiveCfg = Debug|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Debug|x86.Build.0 = Debug|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Release|Any CPU.ActiveCfg = Release|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Release|Mixed Platforms.Build.0 = Release|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Release|x86.ActiveCfg = Release|x86
+ {5719C4C6-D7CC-47FA-B294-C57E0BC6B06F}.Release|x86.Build.0 = Release|x86
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {E1C1D499-15ED-454A-AE34-35F62E53250C}.Release|x86.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal