refactor: 将Framework库和RT、UI放在同一个解决方案中。

This commit is contained in:
SL
2026-06-01 17:48:28 +08:00
parent 1948f4290d
commit b73d39a6b1
4331 changed files with 506148 additions and 49363 deletions
@@ -0,0 +1,24 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsCellAccessPermEditModeToButtonContent : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isCellAccessPermEditMode)
{
return isCellAccessPermEditMode ? "Exit" : "Cell-Perm";
}
return "Cell-Perm";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Globalization;
using System.Windows.Data;
using ExtendedGrid.Microsoft.Windows.Controls;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsCellAccessPermEditModeToDgSelectionMode : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isCellAccessPermEditMode)
{
return isCellAccessPermEditMode ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended;
}
return DataGridSelectionMode.Extended;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Globalization;
using System.Windows.Data;
using ExtendedGrid.Microsoft.Windows.Controls;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsCellAccessPermEditModeToDgSelectionUnit : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isCellAccessPermEditMode)
{
return isCellAccessPermEditMode ? DataGridSelectionUnit.Cell : DataGridSelectionUnit.FullRow;
}
return DataGridSelectionUnit.FullRow;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsCompareDifferentBrushConvent : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isHighlighted)
return isHighlighted
? new SolidColorBrush(Colors.LightSalmon)
: new SolidColorBrush(Colors.Transparent);
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Collections;
using System.Globalization;
using System.Windows.Data;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsDgSelectionCountEqualsOneConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is IList selection)
{
return selection.Count == 1;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,26 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsHighlightedToBorderBrush : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isHighlighted)
return isHighlighted
? new SolidColorBrush(Colors.Yellow)
: new SolidColorBrush(Colors.Transparent);
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsHighlightedToBorderThickness : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isHighlighted)
return isHighlighted ? new Thickness(3) : new Thickness(0);
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,28 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class IsSavedToNameMarkVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isChanged)
{
if (parameter?.ToString() == "R")
isChanged = !isChanged;
return isChanged ? Visibility.Visible : Visibility.Collapsed;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,30 @@
using System;
using System.Globalization;
using System.Windows.Data;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class ParamToCellTooltipConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is IParam param))
return null;
if (!param.IsValid)
return param.ValidationError;
if (param is DoubleParam dblParam)
return $"{dblParam.Minimun} - {dblParam.Maximun}";
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Globalization;
using System.Windows.Data;
using MECF.Framework.Common.Account.Permissions;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class ParamValueDisplayConverter : IMultiValueConverter
{
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
{
// value[0] must be Param.Value
// value[1] must be Param.Permission
// value[2] must be Param.IsHideValue
// value[3] must be Param.HiddenValueMasking
if (value is not { Length: 4 })
return value;
if (value[1] is MenuPermissionEnum perm && value[2] is bool isHideValue && value[3] is string masking)
{
return perm == MenuPermissionEnum.MP_NONE | isHideValue ? masking : value[0].ToString();
}
return value[0];
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,27 @@
using System;
using System.Globalization;
using System.Windows.Data;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.UI.Client.ClientBase;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters;
/// <summary>
/// 配方参数权限转换为IsEnabled属性值的转换器。
/// </summary>
public class PermissionToIsEnabledConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is MenuPermissionEnum perm)
return perm == MenuPermissionEnum.MP_READ_WRITE;
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
@@ -0,0 +1,26 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class RecipeErrorsCountToBadgeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is int cnt))
return null;
if (cnt == 0)
return null;
return cnt;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class SelectedRecipeStepsToListConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is List<RecipeStep> list)
return (IList)list;
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is IList list)
{
return list.Cast<RecipeStep>().ToList();
}
return null;
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Globalization;
using System.Windows.Data;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
{
public class StepNoToCxtMenuTitleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is StepParam sp)
{
return $"Step No. {sp.Value}";
}
return "Unknown";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}