diff options
Diffstat (limited to 'Rx/NET/Samples/HOL/CS/Excercise7/Step06/Program.cs')
-rw-r--r-- | Rx/NET/Samples/HOL/CS/Excercise7/Step06/Program.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Rx/NET/Samples/HOL/CS/Excercise7/Step06/Program.cs b/Rx/NET/Samples/HOL/CS/Excercise7/Step06/Program.cs new file mode 100644 index 0000000..28e07b6 --- /dev/null +++ b/Rx/NET/Samples/HOL/CS/Excercise7/Step06/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.Reactive.Linq; +using System.Windows.Forms; +using System.Reactive.Disposables; +using Excercise7.DictionarySuggestService; + +namespace Excercise7 +{ + class Program + { + static void Main() + { + var svc = new DictServiceSoapClient("DictServiceSoap"); + var matchInDict = Observable.FromAsyncPattern<string, string, string, DictionaryWord[]> + (svc.BeginMatchInDict, svc.EndMatchInDict); + + Func<string, IObservable<DictionaryWord[]>> matchInWordNetByPrefix = + term => matchInDict("wn", term, "prefix"); + + var res = matchInWordNetByPrefix("react"); + var subscription = res.Subscribe( + words => + { + foreach (var word in words) + Console.WriteLine(word.Word); + }, + ex => + { + Console.Error.WriteLine(ex.Message); + } + ); + + Console.ReadLine(); + + } + } +} |