修复错误

This commit is contained in:
ShrlAlgo
2025-09-12 09:55:36 +08:00
parent a86ed1c670
commit 0d0afbc78e
39 changed files with 706 additions and 737 deletions

View File

@@ -1,5 +1,6 @@
using System.Globalization;
using System.Windows.Data;
using Color = System.Windows.Media.Color;
namespace ShrlAlgoToolkit.RevitAddins.Converters;
@@ -9,23 +10,24 @@ namespace ShrlAlgoToolkit.RevitAddins.Converters;
/// </summary>
public class Rv2WinColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var color = (Autodesk.Revit.DB.Color)value;
//if (Autodesk.Revit.DB.SelectedColor.InvalidColorValue)
//{
//}
if (color is { IsValid: true })
{
var rgb = Color.FromRgb(color.Red, color.Green, color.Blue);
return rgb;
}
public static Rv2WinColorConverter Instance { get; } = new Rv2WinColorConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var color = (Autodesk.Revit.DB.Color)value;
//if (Autodesk.Revit.DB.SelectedColor.InvalidColorValue)
//{
//}
if (color is { IsValid: true })
{
var rgb = Color.FromRgb(color.Red, color.Green, color.Blue);
return rgb;
}
return new Color();
}
return new Color();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is Color rgb ? new Autodesk.Revit.DB.Color(rgb.R, rgb.G, rgb.B) : (object)Autodesk.Revit.DB.Color.InvalidColorValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is Color rgb ? new Autodesk.Revit.DB.Color(rgb.R, rgb.G, rgb.B) : (object)Autodesk.Revit.DB.Color.InvalidColorValue;
}
}