Browse Source

Added EqualsWithTolerance Utility Function to CoreUtils
Improved Coloring of CodePopupEditor

frogsoftware 1 year ago
parent
commit
e01adfeda1

+ 6 - 0
InABox.Core/CoreUtils.cs

@@ -94,6 +94,12 @@ namespace InABox.Core
     [LibraryInitializer]
     public static class CoreUtils
     {
+
+        public static bool EqualsWithTolerance(this double value, double other, double tolerance = 0.0001)
+        {
+            return Math.Abs(value - other) < tolerance;
+        }
+        
         private static readonly List<Type> entities = new List<Type>();
 
         public static Dictionary<string, long> TypeListSummary = new Dictionary<string, long>();

+ 5 - 4
inabox.wpf/DynamicGrid/Editors/CodePopupEditor/CodePopupEditorControl.cs

@@ -55,7 +55,7 @@ namespace InABox.DynamicGrid
                 HorizontalAlignment = HorizontalAlignment.Stretch
             };
             Editor.BorderThickness = new Thickness(0.75);
-            Editor.BorderBrush = new SolidColorBrush(Colors.Black);
+            Editor.BorderBrush = new SolidColorBrush(Colors.Silver);
             Editor.SetValue(Grid.ColumnProperty, 0);
             Editor.SetValue(Grid.RowProperty, 0);
 
@@ -74,7 +74,7 @@ namespace InABox.DynamicGrid
                 Focusable = false
             };
             Select.BorderThickness = new Thickness(0, 0.75, 0.75, 0.75);
-            Select.BorderBrush = new SolidColorBrush(Colors.Black);
+            Select.BorderBrush = new SolidColorBrush(Colors.Gray);
             Select.SetValue(Grid.ColumnProperty, 1);
             Select.SetValue(Grid.RowProperty, 0);
             Select.Click += Select_Click;
@@ -88,7 +88,8 @@ namespace InABox.DynamicGrid
                 Margin = new Thickness(5, 0, 0, 0),
                 IsReadOnly = true,
                 Focusable = false,
-                Background = new SolidColorBrush(Colors.Gainsboro)
+                Background = new SolidColorBrush(Colors.WhiteSmoke),
+                BorderBrush = new SolidColorBrush(Colors.Silver)
             };
             Description.SetValue(Grid.ColumnProperty, 2);
             Description.SetValue(Grid.RowProperty, 0);
@@ -331,7 +332,7 @@ namespace InABox.DynamicGrid
 
         public override void SetColor(Color color)
         {
-            Editor.Background = new SolidColorBrush(color);
+            Editor.Background = IsEnabled ?  new SolidColorBrush(color) : new SolidColorBrush(Colors.WhiteSmoke);
         }
     }
 }