Program.cs 981 B

1234567891011121314151617181920212223242526272829303132
  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 input = "reactive";
  18. for (int len = 3; len <= input.Length; len++)
  19. {
  20. var req = input.Substring(0, len);
  21. matchInWordNetByPrefix(req).Subscribe(
  22. words => Console.WriteLine(req + " --> " + words.Length)
  23. );
  24. }
  25. Console.ReadLine();
  26. }
  27. }
  28. }