예제 #1
0
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The Dfa user object running the code example.
    /// </param>
    public override void Run(DfaUser user) {
      // Create SpotlightRemoteService instance.
      SpotlightRemoteService service = (SpotlightRemoteService) user.GetService(
          DfaService.v1_19.SpotlightRemoteService);

      // Set search criteria.
      CountrySearchCriteria countrySearchCriteria = new CountrySearchCriteria();
      countrySearchCriteria.secure = false;

      try {
        // Get countries.
        Country[] countries = service.getCountriesByCriteria(countrySearchCriteria);

        // Display country names, codes and secure server support information.
        if (countries != null) {
          foreach (Country result in countries) {
            Console.WriteLine("Country name \"{0}\", country code \"{1}\", supports a secure " +
                "server? \"{2}\".", result.name, result.id, result.secure);
          }
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to retrieve countries. Exception says \"{0}\"", ex.Message);
      }
    }
예제 #2
0
 public Country[] getCountriesByCriteria(CountrySearchCriteria searchCriteria) {
   object[] results = this.Invoke("getCountriesByCriteria", new object[] {searchCriteria});
   return ((Country[]) (results[0]));
 }