首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -0,0 +1,27 @@
using System;
using System.Globalization;
using System.Windows.Data;
using DrawingColor = System.Drawing.Color;
using MediaColor = System.Windows.Media.Color;
namespace Sicentury.Core.Converters
{
internal class DrawingColorToMediaColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DrawingColor dc)
return MediaColor.FromArgb(dc.A, dc.R, dc.G, dc.B);
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is MediaColor mc)
return DrawingColor.FromArgb(mc.A, mc.R, mc.G, mc.B);
return value;
}
}
}
@@ -0,0 +1,22 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;
namespace Sicentury.Core.Converters
{
public class DummyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Debugger.Break();
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
Debugger.Break();
return value;
}
}
}
@@ -0,0 +1,26 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace Sicentury.Core.Converters
{
internal class MediaColorToSolidColorBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Color color)
return new SolidColorBrush(color);
return new SolidColorBrush(Colors.Black);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is SolidColorBrush brush)
return brush.Color;
return Colors.Black;
}
}
}
@@ -0,0 +1,27 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace Sicentury.Core.Converters
{
public class ParameterNodeStatisticToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double dv)
{
if (double.IsNaN(dv) || double.IsInfinity(dv))
return "";
return dv.ToString("F3");
}
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Sicentury.Core.Converters
{
internal class ParameterNodeTreeViewVisibilityMultiBindingConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
// 如果绑定的参数个数错误,隐藏节点
if (values.Length != 2)
{
Debugger.Break();
return Visibility.Collapsed;
}
if (values[0] is bool isMatch && values[1] is Visibility visibility)
{
// 如果设置为隐藏,则无论是否Filter匹配,均隐藏节点
if (visibility != Visibility.Visible)
return visibility;
// 如果设置为显示,则根据Filter是否匹配决定是否显示节点
if (isMatch == false)
return Visibility.Collapsed;
return Visibility.Visible;
}
// 如果传入的参数类型错误,隐藏节点
Debugger.Break();
return Visibility.Collapsed;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}