public void LoadDevices(Library.Core.Room Room, ushort RoomNumber) { this.InitializeComponent(); Devices = Room.Devices; this.RoomNumber = RoomNumber; foreach (var _Device in Room.Devices) { _Device _Dev = new _Device(); _Dev.DeviceImagePath = _Device.ImagePath; _Dev.DeviceName = _Device.Name; if (_Device.Status == Library.Core.Device.StatusEnum.On) { _Dev.DeviceStatusColor = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 99, 0)); } else { _Dev.DeviceStatusColor = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 128, 128, 128)); } _Dev.Id = _Device.Id; _Dev.DeviceToolTip = "R" + RoomNumber.ToString() + "\\Dev" + _Device.Id.ToString(); ListView_Devices.Items.Add(_Dev); } txt_RoomName.Text = Room.RoomName; }
private void ListView_Devices_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { Library.Core.Device SelectedDevice = null; foreach (var _Dev in Devices) { if (((_Device)(ListView_Devices.SelectedItem)).Id == _Dev.Id) { SelectedDevice = _Dev; break; } } if (SelectedDevice.Status == Library.Core.Device.StatusEnum.On) { SelectedDevice.TurnOff(); } else if (SelectedDevice.Status == Library.Core.Device.StatusEnum.Off) { SelectedDevice.TurnOn(); } ListView_Devices.Items.Clear(); foreach (var _Device in Devices) { _Device _Dev = new _Device(); _Dev.DeviceImagePath = _Device.ImagePath; _Dev.DeviceName = _Device.Name; if (_Device.Status == Library.Core.Device.StatusEnum.On) { _Dev.DeviceStatusColor = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 99, 0)); } else { _Dev.DeviceStatusColor = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 128, 128, 128)); } _Dev.Id = _Device.Id; _Dev.DeviceToolTip = "R" + RoomNumber.ToString() + "\\Dev" + _Device.Id.ToString(); ListView_Devices.Items.Add(_Dev); } }
public DeviceDataControl(_Device Device) { Init(Device); }
public void Init(_Device Device) { CurrentDevice = Device; }