Debian Codegraph @

external/rx/Rx/NET/Samples/HOL/CS/Excercise7/Step06/Program.cs

raw
1 using System;
2 using System.Reactive.Linq;
3 using System.Windows.Forms;
4 using System.Reactive.Disposables;
5 using Excercise7.DictionarySuggestService;
6
7 namespace Excercise7
8 {
9 class Program
10 {
11 static void Main()
12 {
13 var svc = new DictServiceSoapClient("DictServiceSoap");
14 var matchInDict = Observable.FromAsyncPattern<string, string, string, DictionaryWord[]>
15 (svc.BeginMatchInDict, svc.EndMatchInDict);
16
17 Func<string, IObservable<DictionaryWord[]>> matchInWordNetByPrefix =
18 term => matchInDict("wn", term, "prefix");
19
20 var res = matchInWordNetByPrefix("react");
21 var subscription = res.Subscribe(
22 words =>
23 {
24 foreach (var word in words)
25 Console.WriteLine(word.Word);
26 },
27 ex =>
28 {
29 Console.Error.WriteLine(ex.Message);
30 }
31 );
32
33 Console.ReadLine();
34
35 }
36 }
37 }