Example #1
0
        public override void UpdateSettings <T>(object selectedItem)
        {
            CapabilitySummary capability = (CapabilitySummary)selectedItem;

            SettingsPane.RemoveAll();

            var labelId = new Label("Id:")
            {
                X = 0, Y = 0
            };

            SettingsPane.Add(labelId);
            var deviceId = new TextField($"{capability.Id}")
            {
                X = Pos.Right(labelId) + 1, Y = 0, Width = 40
            };

            deviceId.ColorScheme = Colors.Base;
            deviceId.ReadOnly    = true;
            SettingsPane.Add(deviceId);

            var labelDeviceLabel = new Label("Status:")
            {
                X = 0, Y = 1
            };

            SettingsPane.Add(labelDeviceLabel);
            var deviceLabel = new TextField($"{capability?.Status}")
            {
                X = Pos.Right(labelDeviceLabel) + 1, Y = 1, Width = 40
            };

            deviceLabel.ColorScheme = Colors.Base;
            deviceLabel.ReadOnly    = true;
            SettingsPane.Add(deviceLabel);

            var labelType = new Label("Version:")
            {
                X = 0, Y = 2
            };

            SettingsPane.Add(labelType);
            var deviceType = new TextField($"{capability._Version}")
            {
                X = Pos.Right(labelType) + 1, Y = 2, Width = 40
            };

            deviceType.ColorScheme = Colors.Base;
            deviceType.ReadOnly    = true;
            SettingsPane.Add(deviceType);
        }
Example #2
0
        public override void UpdateSettings <T>(object selectedItem)
        {
            Device device = (Device)selectedItem;

            _deviceDetailsFrame.RemoveAll();

            var labelId = new Label("Id:")
            {
                X = 0, Y = 0
            };

            _deviceDetailsFrame.Add(labelId);
            var deviceId = new TextField($"{device.DeviceId}")
            {
                X = Pos.Right(labelId) + 1, Y = 0, Width = 40
            };

            deviceId.ColorScheme = Colors.Base;
            _deviceDetailsFrame.Add(deviceId);

            var labelDeviceLabel = new Label("Label:")
            {
                X = 0, Y = 1
            };

            _deviceDetailsFrame.Add(labelDeviceLabel);
            var deviceLabel = new TextField($"{device?.Label}")
            {
                X = Pos.Right(labelDeviceLabel) + 1, Y = 1, Width = 40
            };

            deviceLabel.ColorScheme = Colors.Base;
            _deviceDetailsFrame.Add(deviceLabel);

            var labelType = new Label("Type:")
            {
                X = 0, Y = 2
            };

            _deviceDetailsFrame.Add(labelType);
            var deviceType = new TextField($"{device.DeviceTypeName?.Trim()}")
            {
                X = Pos.Right(labelType) + 1, Y = 2, Width = 40
            };

            deviceType.ColorScheme = Colors.Base;
            _deviceDetailsFrame.Add(deviceType);

            var labelComponents = new Label("Components:")
            {
                X = 0, Y = 3
            };

            _deviceDetailsFrame.Add(labelComponents);
            var deviceComponents = new TextField($"{device.Components.Count}")
            {
                X = Pos.Right(labelComponents) + 1, Y = 3, Width = 40
            };

            deviceComponents.ColorScheme = Colors.Base;
            _deviceDetailsFrame.Add(deviceComponents);

            // Device Location pane
            _deviceLocationFrame.RemoveAll();

            string locationName = "";

            if (device.LocationId != null)
            {
                locationName = STClient.GetAllLocations().Items.Where(l => l.LocationId.ToString().Equals(device.LocationId))?.FirstOrDefault().Name;
            }

            string roomName = "";

            if (device.RoomId != null)
            {
                roomName = STClient.GetAllRooms(device.LocationId).Items.Where(r => r.RoomId.ToString().Equals(device.RoomId))?.FirstOrDefault().Name;
            }

            var labelLocation = new Label("Location:")
            {
                X = 0, Y = 0
            };

            _deviceLocationFrame.Add(labelLocation);
            var deviceLocation = new TextField($"{locationName}")
            {
                X = Pos.Right(labelLocation) + 1, Y = 0, Width = 40
            };

            deviceLocation.ColorScheme = Colors.Base;
            _deviceLocationFrame.Add(deviceLocation);

            var labelRoom = new Label("Room:")
            {
                X = 0, Y = 1
            };

            _deviceLocationFrame.Add(labelRoom);
            var deviceRoom = new TextField($"{roomName}")
            {
                X = Pos.Right(labelRoom) + 1, Y = 1, Width = 40
            };

            deviceRoom.ColorScheme = Colors.Base;
            _deviceLocationFrame.Add(deviceRoom);
        }