From 50214741e77326f1bf0875c19aeaefd17c4e3bc8 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Wed, 6 Jun 2018 12:31:22 -0500 Subject: [PATCH] PR - backings for a lazy life --- .../spark/view/Spark/Ladder/LadderOrderVM.cs | 35 +++++-------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/src/client/spark/view/Spark/Ladder/LadderOrderVM.cs b/src/client/spark/view/Spark/Ladder/LadderOrderVM.cs index f906cadb6..dd255c5f5 100644 --- a/src/client/spark/view/Spark/Ladder/LadderOrderVM.cs +++ b/src/client/spark/view/Spark/Ladder/LadderOrderVM.cs @@ -16,6 +16,7 @@ namespace mbts.spark { class LadderOrderVM : DisposableViewModelBase { #region Colors static readonly Color _colorbg = Colors.White, _darkbg = Color.FromRgb(0xbf, 0xbf, 0xbf); + static readonly Brush _color_bg_brush = _colorbg.rgb_color().rgb_brush(); static Brush mkbrush(Color color, Color endcolor, double pct_complete) { GradientStopCollection stops = new GradientStopCollection(); stops.Add(new GradientStop(color, 0.0)); @@ -34,7 +35,7 @@ namespace mbts.spark { readonly Property _font_family; readonly Property _font_weight; readonly Property _font_size; - readonly Property _foreground; + readonly Property _foreground, _background, _hoverbackground, _border; IObservable _bs; LadderSettings.BadgeStyle _current_badge_style; int _n_active_price_change_ops = 0; @@ -56,6 +57,9 @@ namespace mbts.spark { _font_weight = backing(nameof(font_weight), parent.settings, get_font_weight, get_font_weight(fs)); _font_size = backing(nameof(font_size), parent.settings, get_font_size, get_font_size(fs)); _foreground = backing(nameof(foreground), parent.settings, get_foreground, get_foreground(fs)); + _background = backing(nameof(background), _color_bg_brush); + _hoverbackground = backing(nameof(hoverbackground), _color_bg_brush); + _border = backing(nameof(border), _color_bg_brush); FontFamily get_font_family(LadderSettings s) => new FontFamily(s.orders_column.font_family); FontWeight get_font_weight(LadderSettings s) => ui.utility.text.TextUtils.from_open_type_weight_safe(s.orders_column.font_weight); double get_font_size(LadderSettings s) => s.orders_column.font_size; @@ -209,32 +213,9 @@ namespace mbts.spark { public FontWeight font_weight => _font_weight.Value; public double font_size => _font_size.Value; public Brush foreground => _foreground.Value; - - private Brush _background; - public Brush background { - get { return _background; } - private set { - _background = value; - RaisePropertyChanged(); - } - } - private Brush _hoverbackground; - public Brush hoverbackground { - get { return _hoverbackground; } - private set { - _hoverbackground = value; - RaisePropertyChanged(); - } - } - - private Brush _border; - public Brush border { - get { return _border; } - private set { - _border = value; - RaisePropertyChanged(); - } - } + public Brush background { get; private set; } + public Brush hoverbackground { get; private set; } + public Brush border { get; private set; } public IEnumerable orders => _orders.Values; void _cancel_order() {