整理代码
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Color = System.Windows.Media.Color;
|
||||
|
||||
namespace Sai.RvKits.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Autodesk颜色转Windows系统颜色
|
||||
/// </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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Sai.RvKits.Converters
|
||||
{
|
||||
public class SearchTypeValueConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
var searchText = values[1] as string;
|
||||
var cell = values[2] as DataGridCell;
|
||||
|
||||
var head = cell?.Column?.Header?.ToString();
|
||||
|
||||
return head is "族类型" && !string.IsNullOrEmpty(searchText) && !string.IsNullOrEmpty(cellText) ? cellText.Contains(searchText) : (object)false;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public class SearchFamilyValueConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
var searchText = values[1] as string;
|
||||
var cell = values[2] as DataGridCell;
|
||||
|
||||
var head = cell?.Column?.Header?.ToString();
|
||||
|
||||
return head is "族名称" && !string.IsNullOrEmpty(searchText) && !string.IsNullOrEmpty(cellText) ? cellText.Contains(searchText) : (object)false;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user