private void PopulateInput() { InputId = AvailableLedIds.First(l => l.Equals(LedLayout.Id)); InputShape = LedLayout.Shape; InputShapeData = LedLayout.ShapeData; InputX = LedLayout.DescriptiveX; InputY = LedLayout.DescriptiveY; InputWidth = LedLayout.DescriptiveWidth; InputHeight = LedLayout.DescriptiveHeight; }
private void PopulateInput() { if (int.TryParse(LedLayout.Id, out int numericLedId)) { InputId = LedLayout.Id; } else { var ledId = AvailableLedIds.FirstOrDefault(l => l.Equals(LedLayout.Id)); InputId = ledId ?? throw new Exception($"Failed to find LED ID {LedLayout.Id}, the layout editor may need an update."); } InputShape = LedLayout.Shape; InputShapeData = LedLayout.ShapeData; InputX = LedLayout.DescriptiveX; InputY = LedLayout.DescriptiveY; InputWidth = LedLayout.DescriptiveWidth; InputHeight = LedLayout.DescriptiveHeight; }
private void UpdateAvailableLedIds() { AvailableLedIds.Clear(); AvailableLedIds.AddRange(Model.GetAvailableLedIds(LedLayout.Id)); }