Program.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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(
  19. words =>
  20. {
  21. foreach (var word in words)
  22. Console.WriteLine(word.Word);
  23. },
  24. ex =>
  25. {
  26. Console.Error.WriteLine(ex.Message);
  27. }
  28. );
  29. Console.ReadLine();
  30. }
  31. }
  32. }