Program.cs 891 B

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