From 9382807fe8aebb5df5a057e77c0cf38205d129a2 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Sat, 3 Feb 2024 23:29:09 -0600 Subject: [PATCH] fix: Fix improper 'OfType' linq cast Previously, animations were expressed through polymorphism (derived from the base class CellAnimation), but the new impl uses composition. This 'OfType' call was leftover from the polymorphism implementation, an attempt to linq cast elements of base class (CellAnimation) to BackgroundAnimation. --- .../spark/view/Controls/DIYGrid/CellRender/CellRender.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/spark/view/Controls/DIYGrid/CellRender/CellRender.cs b/src/client/spark/view/Controls/DIYGrid/CellRender/CellRender.cs index 3e7b6e766..46f03310a 100644 --- a/src/client/spark/view/Controls/DIYGrid/CellRender/CellRender.cs +++ b/src/client/spark/view/Controls/DIYGrid/CellRender/CellRender.cs @@ -70,8 +70,7 @@ namespace mbts.ui.controls { public double border_thickness => _border_thickness.Value; void _apply_animation() { - var bga = _animations.OfType().FirstOrDefault(); - if (bga != null) { + if (_animations.Select(a => a.background_animation).ExceptNull().TryGetFirst(out var bga)) { _background.set(bga.brush); if (bga.pen != null) { _border.set(bga.pen.Brush);