예제 #1
0
        public static void NonReactiveDictionarySuggestSevice()
        {
            var svc = new DictServiceSoapClient("DictServiceSoap");

            //Starts a webservice call
            svc.BeginMatchInDict("wn", "react", "prefix",
                                 //AsyncCallback delegate
                                 iar =>
                                     {
                                         DictionaryWord[] words = svc.EndMatchInDict(iar);
                                         foreach (DictionaryWord word in words)
                                         {
                                             Console.WriteLine(word.Word);
                                         }
                                     },
                                 null
                );

            //The above operation is quite "clumsy",
            //composition with our other Async data sources (TextBox) becomes difficult.
            //It is also not clear how one can cancel existing requests,
            //such that the Callback procedure is guaranteed not to be called anymore.
            //The data aspect of the Async call not being immediately apparent.

            Console.ReadLine(); //Wait to allow user to see output.
        }
예제 #2
0
        private void Callback(IAsyncResult iar)
        {
            var words = _svc.EndMatchInDict(iar);

            foreach (var word in words)
            {
                Console.WriteLine(word.Word);
            }
        }
예제 #3
0
        static void Main()
        {
            var svc = new DictServiceSoapClient("DictServiceSoap");
            svc.BeginMatchInDict("wn", "react", "prefix",
                iar =>
                {
                    var words = svc.EndMatchInDict(iar);
                    foreach (var word in words)
                        Console.WriteLine(word.Word);
                },
                null
            );

            Console.ReadLine();

        }
예제 #4
0
        void old()
        {
            var svc = new DictServiceSoapClient("DictServiceSoap");

            svc.BeginMatchInDict("wn", "react", "prefix",
                                 iar =>
            {
                var words = svc.EndMatchInDict(iar);
                foreach (var w in words)
                {
                    Console.WriteLine(w.Word);
                }
            }, null);

            Console.ReadLine();
        }
예제 #5
0
 static DictionaryWord[] EndMatch(IAsyncResult result)
 {
     return(service.EndMatchInDict(result));
 }