From cde9fc6a8fe569203cb991121a35c2a9c7f4c420 Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Tue, 22 Jan 2013 17:25:22 +0900 Subject: import 2b5dbddd740b, new directory structure in the original rx. --- Rx/NET/Samples/HOL/CS/Excercise5/Step03/Program.cs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Rx/NET/Samples/HOL/CS/Excercise5/Step03/Program.cs (limited to 'Rx/NET/Samples/HOL/CS/Excercise5/Step03/Program.cs') diff --git a/Rx/NET/Samples/HOL/CS/Excercise5/Step03/Program.cs b/Rx/NET/Samples/HOL/CS/Excercise5/Step03/Program.cs new file mode 100644 index 0000000..5d06ae5 --- /dev/null +++ b/Rx/NET/Samples/HOL/CS/Excercise5/Step03/Program.cs @@ -0,0 +1,31 @@ +using System; +using System.Reactive.Linq; +using System.Windows.Forms; +using System.Reactive.Disposables; + +namespace Excercise5 +{ + class Program + { + static void Main() + { + var txt = new TextBox(); + + var frm = new Form() + { + Controls = { txt } + }; + + var input = (from evt in Observable.FromEventPattern(txt, "TextChanged") + select ((TextBox)evt.Sender).Text) + .Do(inp => Console.WriteLine("Before DistinctUntilChanged: " + inp)) + .DistinctUntilChanged(); + + using (input.Subscribe(inp => Console.WriteLine("User wrote: " + inp))) + { + Application.Run(frm); + } + + } + } +} -- cgit v1.2.3