Пример #1
0
 /// <summary>
 ///     Initializes the AirportInfoComponent and retreives airport status via IATA code
 /// </summary>
 /// <param name="iata">IATA code of the airport</param>
 /// <returns>JSON data for the airport.</returns>
 public static object Execute(string iata)
 {
     // active components should only be accessed within using blocks
     // to free ChannelEnvironments and ComputationUnits automatically
     using (var component = new AirportInfoComponent())
     {
         var execute = component.Execute(AirportInfoChannelCollection.FAA_API, iata) as List <object>;
         return(execute[0]);
     }
 }
Пример #2
0
        public static async Task <string> ExecuteAsync(string iata)
        {
            using (var component = new AirportInfoComponent())
            {
                var asyncResult = await component.
                                  ExecuteAsync(AirportInfoChannelCollection.FAA_API, iata).
                                  ContinueWith(taskResult => (string)taskResult.Result);

                return(asyncResult);
            }
        }