From 3c44f0746b865db2e1bf421f5fae378090b3a8bb Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Wed, 28 Mar 2018 17:08:45 -0400 Subject: [PATCH] Freeze brushes by default --- src/client/spark/core/FontsAndColors/BTSColor.cs | 4 +++- src/client/spark/core/FontsAndColors/BTSColors.cs | 9 +-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/client/spark/core/FontsAndColors/BTSColor.cs b/src/client/spark/core/FontsAndColors/BTSColor.cs index 213169ed1..7e7969b03 100644 --- a/src/client/spark/core/FontsAndColors/BTSColor.cs +++ b/src/client/spark/core/FontsAndColors/BTSColor.cs @@ -185,7 +185,9 @@ namespace mbts.ui static public implicit operator System.Windows.Media.Brush(BTSColor x) { - return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(x.A, x.R, x.G, x.B)); + var v = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(x.A, x.R, x.G, x.B)); + v.Freeze(); + return v; } static public implicit operator BTSColor(System.Windows.Media.SolidColorBrush x) diff --git a/src/client/spark/core/FontsAndColors/BTSColors.cs b/src/client/spark/core/FontsAndColors/BTSColors.cs index b24e3e8ea..dcdbdb235 100644 --- a/src/client/spark/core/FontsAndColors/BTSColors.cs +++ b/src/client/spark/core/FontsAndColors/BTSColors.cs @@ -147,14 +147,7 @@ namespace mbts.ui { // 'default_background' and 'filled' seemed too pale against the log viewer's current style // as we restyle the ladder, and perhaps the log viewer, maybe this will change, in the meantime, here they are. static readonly BTSColor _sent = new BTSColor(0x92, 0x5B, 0xBE); - static readonly Brush _sent_brush, _filled_dark_brush; - - static Orders() { - _sent_brush = new SolidColorBrush(_sent); - _filled_dark_brush = new SolidColorBrush(filled_dark); - _sent_brush.Freeze(); - _filled_dark_brush.Freeze(); - } + static readonly Brush _sent_brush = _sent, _filled_dark_brush = _sent; // Base Colors [DisplayInfo(name = "Orders")]