Exemplo n.º 1
0
        public async Task <RoomTemperature> GetRoomTemperatureAsync()
        {
            if (UseFakes)
            {
                await Task.Delay(1000);

                return(FakeRoomTemperature.Create());
            }

            var storedValue = GetStoredSensorData <RoomTemperature>();

            if (storedValue != null)
            {
                return((RoomTemperature)storedValue);
            }

            await GetLatestData();

            return((RoomTemperature)GetStoredSensorData <RoomTemperature>());
        }
        public async Task <RoomTemperature> GetRoomTemperatureAsync()
        {
            if (UseFakes)
            {
                await Task.Delay(1000);

                return(FakeRoomTemperature.Create());
            }

            var storedValue = GetStoredSensorData <RoomTemperature>();

            if (storedValue != null)
            {
                return((RoomTemperature)storedValue);
            }

            var roomData = await GetRoomSensorData(_authenticationService.AuthenticatedUser.Token, _roomId);

            ProcessRoomData(roomData);

            return((RoomTemperature)GetStoredSensorData <RoomTemperature>());
        }