public PagedRooms GetAllRooms(string locationId = null) { if (_allRooms == null) { if (locationId != null) { _allRooms = _roomsApi.ListRooms(locationId); } else { _allRooms = new PagedRooms(); var locations = GetAllLocations(); if (locations !.Items != null) { foreach (var location in locations.Items) { var locationRooms = _roomsApi.ListRooms(location.LocationId.ToString()); if (locationRooms.Items?.Count > 0) { _allRooms.Items ??= new List <SmartThingsNet.Model.Room>(); _allRooms.Items.AddRange(locationRooms.Items); } } } } } return(_allRooms); }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { _allDevices = null; _allLocations = null; _allRooms = null; _allScenes = null; _allRules = null; _allSchedules = null; _allApps = null; _allSubscriptions = null; _allInstalledApps = null; _allDeviceProfiles = null; _devicesApi = null; _locationsApi = null; _roomsApi = null; _scenesApi = null; _rulesApi = null; _schedulesApi = null; _appsApi = null; _subscriptionsApi = null; _installedAppsApi = null; _deviceProfilesApi = null; } _disposedValue = true; } }
public async Task <PagedRooms> GetAllRoomsAsync(string locationId) { if (_allRooms == null) { _allRooms = await _roomsApi.ListRoomsAsync(locationId); } return(_allRooms); }
public void ResetData() { _allDevices = null; _allLocations = null; _allRooms = null; _allScenes = null; _allRules = null; _allSchedules = null; _allApps = null; _allSubscriptions = null; _allInstalledApps = null; _allDeviceProfiles = null; }