| 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(words => |
| 22 |
{ |
| 23 |
foreach (var word in words) |
| 24 |
Console.WriteLine(word.Word); |
| 25 |
}); |
| 26 |
|
| 27 |
Console.ReadLine(); |
| 28 |
|
| 29 |
} |
| 30 |
} |
| 31 |
} |