private static Place[] CallGetPlaceListMethod(string location)
        {
            TerraServiceSoapClient client = new TerraServiceSoapClient();

            PlaceFacts[] placeFacts = null;

            try
            {
                // Call the Web service method "GetPlaceList".
                placeFacts = client.GetPlaceList(location, numResults, mustHaveImage);

                // If there are exactly 'numResults' results, they are probably truncated.
                if (placeFacts.Length == numResults)
                {
                    throw new Exception("The results have been truncated by the Web service and would not be complete. Please try a different query.");
                }

                // Create Place objects from the PlaceFacts objects returned by the Web service.
                Place[] places = new Place[placeFacts.Length];
                for (int i = 0; i < placeFacts.Length; i++)
                {
                    places[i] = new Place(
                        placeFacts[i].Place.City,
                        placeFacts[i].Place.State,
                        placeFacts[i].PlaceTypeId);
                }

                // Close the WCF client.
                client.Close();

                return(places);
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (System.ServiceModel.CommunicationException)
            {
                client.Abort();
                throw;
            }
        }
        private static Place[] CallGetPlaceListMethod(string location)
        {
            TerraServiceSoapClient client = new TerraServiceSoapClient();

            PlaceFacts[] placeFacts = null;

            try
            {
                // Вызвать метод веб-службы "GetPlaceList".
                placeFacts = client.GetPlaceList(location, numResults, mustHaveImage);

                // Если есть результаты 'numResults', то они, вероятно, отбрасываются.
                if (placeFacts.Length == numResults)
                {
                    throw new InvalidQueryException("The results have been truncated by the Web service and would not be complete. Please try a different query.");
                }

                // Создать объекты Place из объектов PlaceFacts, возвращенных веб-службой.
                Place[] places = new Place[placeFacts.Length];
                for (int i = 0; i < placeFacts.Length; i++)
                {
                    places[i] = new Place(
                        placeFacts[i].Place.City,
                        placeFacts[i].Place.State,
                        placeFacts[i].PlaceTypeId);
                }

                // Закрыть клиент WCF.
                client.Close();

                return(places);
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (System.ServiceModel.CommunicationException)
            {
                client.Abort();
                throw;
            }
        }
        private static Place[] CallGetPlaceListMethod(string location)
        {
            TerraServiceSoapClient client = new TerraServiceSoapClient();

            PlaceFacts[] placeFacts = null;

            try
            {
                // 调用 Web 服务方法“GetPlaceList”。
                placeFacts = client.GetPlaceList(location, numResults, mustHaveImage);

                // 如果恰好有“numResults”个结果,它们可能会被截断。
                if (placeFacts.Length == numResults)
                {
                    throw new InvalidQueryException("The results have been truncated by the Web service and would not be complete. Please try a different query.");
                }

                // 根据 Web 服务返回的 PlaceFacts 对象创建 Place 对象。
                Place[] places = new Place[placeFacts.Length];
                for (int i = 0; i < placeFacts.Length; i++)
                {
                    places[i] = new Place(
                        placeFacts[i].Place.City,
                        placeFacts[i].Place.State,
                        placeFacts[i].PlaceTypeId);
                }

                // 关闭 WCF 客户端。
                client.Close();

                return(places);
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (System.ServiceModel.CommunicationException)
            {
                client.Abort();
                throw;
            }
        }
        private static Place[] CallGetPlaceListMethod(string location)
        {
            TerraServiceSoapClient client = new TerraServiceSoapClient();
            PlaceFacts[] placeFacts = null;

            try
            {
                // Call the Web service method "GetPlaceList".
                placeFacts = client.GetPlaceList(location, numResults, mustHaveImage);

                // If there are exactly 'numResults' results, they are probably truncated.
                if (placeFacts.Length == numResults)
                    throw new InvalidQueryException("The results have been truncated by the Web service and would not be complete. Please try a different query.");

                // Create Place objects from the PlaceFacts objects returned by the Web service.
                Place[] places = new Place[placeFacts.Length];
                for (int i = 0; i < placeFacts.Length; i++)
                {
                    places[i] = new Place(
                        placeFacts[i].Place.City,
                        placeFacts[i].Place.State,
                        placeFacts[i].PlaceTypeId);
                }

                // Close the WCF client.
                client.Close();

                return places;
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (System.ServiceModel.CommunicationException)
            {
                client.Abort();
                throw;
            }
        }