Skip to content

Commit 3b9b347

Browse files
author
LoneWandererProductions
committed
refine Color Converter
Remove Whitespaces
1 parent 5eb5f86 commit 3b9b347

5 files changed

Lines changed: 27 additions & 14 deletions

File tree

Common.Converter/ActiveToColorConverter.cs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ namespace Common.Converter
1919
/// <seealso cref="System.Windows.Data.IValueConverter" />
2020
public class ActiveToColorConverter : IValueConverter
2121
{
22+
/// <summary>
23+
/// Gets or sets the active brush.
24+
/// </summary>
25+
/// <value>
26+
/// The active brush.
27+
/// </value>
28+
public Brush ActiveBrush { get; set; } = new SolidColorBrush(Color.FromRgb(255, 215, 0));
29+
30+
/// <summary>
31+
/// Gets or sets the inactive brush.
32+
/// </summary>
33+
/// <value>
34+
/// The inactive brush.
35+
/// </value>
36+
public Brush InactiveBrush { get; set; } = new SolidColorBrush(Color.FromRgb(60, 60, 60));
37+
2238
/// <summary>
2339
/// Converts a value.
2440
/// </summary>
@@ -33,9 +49,9 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
3349
{
3450
if (value is bool isActive && isActive)
3551
{
36-
return new SolidColorBrush(Color.FromRgb(255, 215, 0)); // Gold for Active
52+
return ActiveBrush; // Gold for Active
3753
}
38-
return new SolidColorBrush(Color.FromRgb(60, 60, 60)); // Dark Gray for Inactive
54+
return InactiveBrush; // Dark Gray for Inactive
3955
}
4056

4157
/// <summary>
@@ -52,17 +68,14 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
5268
{
5369
if (value is SolidColorBrush brush)
5470
{
55-
var color = brush.Color;
56-
if (color == Color.FromRgb(255, 215, 0)) // Gold
57-
{
71+
if (ActiveBrush is SolidColorBrush active && brush.Color == active.Color)
5872
return true;
59-
}
60-
if (color == Color.FromRgb(60, 60, 60)) // Dark Gray
61-
{
73+
74+
if (InactiveBrush is SolidColorBrush inactive && brush.Color == inactive.Color)
6275
return false;
63-
}
6476
}
65-
return false;
77+
78+
return Binding.DoNothing;
6679
}
6780
}
6881
}

Core.Apps/Rules/UnusedClassAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Core.Apps.Rules
2525
/// Analyzer that detects unused classes across a project.
2626
/// Works by scanning all files for class declarations and then checking
2727
/// whether those classes are referenced anywhere else in the project.
28-
///
28+
///
2929
/// Limitations:
3030
/// - Simple regex approach (not a full C# parser).
3131
/// - May flag false positives if a class is used via reflection or dynamically.

Core.Apps/Rules/UnusedConstantAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Core.Apps.Rules
2525
/// Analyzer that detects unused constants and static readonly fields.
2626
/// Works by scanning all files for declarations and then checking
2727
/// whether those constants are referenced anywhere else in the project.
28-
///
28+
///
2929
/// Limitations:
3030
/// - Simple regex approach (not a full C# parser).
3131
/// - May flag false positives if a constant is used via reflection, nameof(), etc.

Imaging/ImagingResources.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public static class ImagingResources
374374
/// <summary>
375375
/// The File Appendix
376376
/// </summary>
377-
public static readonly List<string> Appendix =
377+
public static readonly List<string> Appendix =
378378

379379
[
380380
JpgExt,

RenderEngine/Simple3DRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
using OpenTK.Graphics.OpenGL4;
1010
using System;
11-
using System.Numerics;
11+
using System.Numerics;
1212
using TK = OpenTK.Mathematics;
1313

1414
namespace RenderEngine

0 commit comments

Comments
 (0)