Ejemplo n.º 1
0
 public void GetBusStopList()
 {
     lock (_conn)
     {
         var stopsInDb = GetBusStopsFromDb();
         if (!stopsInDb.Any())
         {
             var client = GetClient();
             client.GetBusStopsListCompleted += (s, e) =>
             {
                 var busStopsFromJson = new BusStopListConverter().GetBusStopsList(e.Result);
                 AddStopsToDb(busStopsFromJson);
             };
             client.GetBusStopsListAsync(Authentication);
         }
     }
 }
Ejemplo n.º 2
0
 public void GetBusStopList(Action<List<BusStop>> callback)
 {
     var stopsInDb = GetBusStopsFromDb();
     if (stopsInDb.Any())
     {
         callback(stopsInDb);
     }
     else
     {
         var client = GetClient();
         client.GetBusStopsListCompleted += (s,e) =>
         {
             var busStopsFromJson = new BusStopListConverter().GetBusStopsList(e.Result);
             AddStopsToDb(busStopsFromJson);
             callback(busStopsFromJson);
         };
         client.GetBusStopsListAsync(Authentication);
     }
 }