public static View GetNoteView(int position, Room room, View convertView) { var view = convertView; if (view == null) view = LayoutInflater.From(Application.Context).Inflate(Resource.Layout.RoomItem, null); view.FindViewById<TextView>(Resource.Id.tvRoomName).Text = room.Name; return view; }
public async Task GetDevicesForRoomAsync(Room room) { var stateList = await GetAllStatesAsync(); var homeMaticRoom = room as HomeMaticRoom; if (homeMaticRoom != null) { // Get List of all devices var allDevicesList = await GetDevicesAsync(); foreach (var device in allDevicesList) { var addDeviceToRoom = false; var homeMaticDevice = device as HomeMaticDevice; if (homeMaticDevice != null) { foreach (var channel in homeMaticDevice.Channels) { // Compare devices channels ISE_IDs with the one from the room list if (!homeMaticRoom.ChannelIds.Contains(channel.IseId)) continue; // Get state from state list var datapoints = stateList.Where(d => d.ChannelIseId == channel.IseId).ToList(); if (datapoints.Any()) channel.SetState(datapoints); // If a device has multiple channels only add it once addDeviceToRoom = true; } if (addDeviceToRoom) room.Devices.Add(device); } else { throw new FormatException("Wrong Format. Non homatic devices detected that cannot be handeld."); } } } else { throw new FormatException("Wrong Format. Please provide a HomeMatic room to this API."); } }
private void LoadDemoData() { CurrentRoom = MainViewModel.Current.RoomList.First(); }
public async Task UpdateStatesForRoomAsync(Room room) { var allStates = await GetAllStatesAsync(); var channels = new List<HomeMaticChannel>(); foreach (var device in room.Devices) foreach (var channel in ((HomeMaticDevice)device).Channels) channels.Add(channel); foreach (var channel in channels) { var datapoints = allStates.Where(s => s.ChannelIseId == channel.IseId); if (datapoints.Any()) channel.SetState(datapoints); else channel.IsVisible = false; // Hide channel when no datapoints are available } }
public Task UpdateStatesForRoomAsync(Room room) { throw new NotImplementedException(); }
public Task GetDevicesForRoomAsync(Room room) { throw new NotImplementedException(); }