mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Project cleanup
This commit is contained in:
1 parent
9ad3e04a69
commit
adac6f4f8c
30 files changed
+254
-268
No files matched your search
@@ -2,30 +2,31 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using Color = RGB.NET.Core.Color;
|
||||
|
||||
namespace Artemis.UI.Converters
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Converts <see cref="T:RGB.NET.Core.Color" /> into <see cref="T:System.Windows.Media.SolidColorBrush" />.
|
||||
/// Converts <see cref="T:RGB.NET.Core.Color" /> into <see cref="T:System.Windows.Media.SolidColorBrush" />.
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(RGB.NET.Core.Color), typeof(SolidColorBrush))]
|
||||
[ValueConversion(typeof(Color), typeof(SolidColorBrush))]
|
||||
public class ColorToSolidColorBrushConverter : IValueConverter
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return new SolidColorBrush(!(value is RGB.NET.Core.Color color)
|
||||
? Color.FromArgb(0, 0, 0, 0)
|
||||
: Color.FromArgb(color.A, color.R, color.G, color.B));
|
||||
return new SolidColorBrush(!(value is Color color)
|
||||
? System.Windows.Media.Color.FromArgb(0, 0, 0, 0)
|
||||
: System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return !(value is SolidColorBrush brush)
|
||||
? RGB.NET.Core.Color.Transparent
|
||||
: new RGB.NET.Core.Color(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
|
||||
? Color.Transparent
|
||||
: new Color(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user