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

Program.cs « Step06 « Excercise7 « CS « HOL « Samples « NET « Rx - github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28e07b6e0242aefa53223050b275f2f784238cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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();

        }
    }
}