Ejemplo n.º 1
0
        public void GetRooms()
        {
            TimeSpan timeSinceLastRetrieve = DateTime.Now.Subtract(_lastRoomsRetrieve);

            if (timeSinceLastRetrieve.TotalSeconds <= 30)
            {
                OnRoomsRetrieved();
                return;
            }

            _lastRoomsRetrieve = DateTime.Now;

            _client.GetRooms().ContinueWith(roomsTask =>
            {
                foreach (Room room in roomsTask.Result)
                {
                    GetRoom(room);
                }

                OnRoomsRetrieved();
            });
        }