Exemple #1
0
        //BUG: Currently doesn't work...pending MonoTouch bug fixes in WCF stack
        public void Search6(string text)
        {
            // use slsvcutil in windows silverlight sdk to genreate proxy and copy into monodevelop project
            // c:\temp>"C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Tools\SlSvcUtil.exe" /n:*,LMT92.Bing.WCF http://api.bing.net/search.wsdl?AppID=InsertYourAppId /noConfig /out:BingServiceWCF.cs
            // manually removed line 25 in the genereated code since SupportsFaults isn't available

            string address = "http://api.bing.net:80/soap.asmx";

            var bingClient = new Bing.WCF.BingPortTypeClient(new System.ServiceModel.BasicHttpBinding(), new System.ServiceModel.EndpointAddress(address));

            var request = new Bing.WCF.SearchRequest {
                AppId   = BING_API_ID,
                Sources = new Bing.WCF.SourceType[] { Bing.WCF.SourceType.Web },
                Query   = text
            };

            bingClient.SearchCompleted += delegate(object sender, Bing.WCF.SearchCompletedEventArgs e) {
                var searchResponse = e.Result;
                var results        = searchResponse.Web.Results.Select(wr => new SearchResultItem {
                    Title = wr.Title
                }).ToList();

                if (_sync != null)
                {
                    _sync(results);
                }
            };

            bingClient.SearchAsync(request);
        }
 //BUG: Currently doesn't work...pending MonoTouch bug fixes in WCF stack
 public void Search6 (string text)
 {
     // use slsvcutil in windows silverlight sdk to genreate proxy and copy into monodevelop project   
     // c:\temp>"C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Tools\SlSvcUtil.exe" /n:*,LMT92.Bing.WCF http://api.bing.net/search.wsdl?AppID=InsertYourAppId /noConfig /out:BingServiceWCF.cs
     // manually removed line 25 in the genereated code since SupportsFaults isn't available
     
     string address = "http://api.bing.net:80/soap.asmx";
     
     var bingClient = new Bing.WCF.BingPortTypeClient (new System.ServiceModel.BasicHttpBinding (), new System.ServiceModel.EndpointAddress (address));
     
     var request = new Bing.WCF.SearchRequest { 
         AppId = BING_API_ID, 
         Sources = new Bing.WCF.SourceType[] { Bing.WCF.SourceType.Web }, 
         Query = text };
     
     bingClient.SearchCompleted += delegate(object sender, Bing.WCF.SearchCompletedEventArgs e) {
         var searchResponse = e.Result;
         var results = searchResponse.Web.Results.Select (wr => new SearchResultItem { Title = wr.Title }).ToList ();
         
         if (_sync != null)
             _sync (results);
     };
     
     bingClient.SearchAsync (request);
 }