首次上传

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,6 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class CheckBoxColumn : EditorDataGridTemplateColumnBase
{
}
}
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices.WindowsRuntime;
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class ComboxColumn : EditorDataGridTemplateColumnBase
{
public ComboxColumn() : base()
{
Options = new List<Option>();
}
public List<Option> Options { get; }
public class Option : IEquatable<Option>, IEquatable<Enum> , IEquatable<string>, IComparable<Option>
{
public Option(string displayName, string controlName, string relatedParameters)
{
DisplayName = displayName;
ControlName = controlName;
RelatedParameters = relatedParameters;
}
public Option(string displayName, string controlName) :
this(displayName, controlName, string.Empty)
{
}
public string ControlName { get; }
public string DisplayName { get; }
public string RelatedParameters { get; }
public override bool Equals(object other)
{
return other switch
{
null => false,
Option destOption => DisplayName == destOption.DisplayName,
_ => DisplayName == other.ToString()
};
}
public override int GetHashCode()
{
unchecked
{
var hashCode = (ControlName != null ? ControlName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (DisplayName != null ? DisplayName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (RelatedParameters != null ? RelatedParameters.GetHashCode() : 0);
return hashCode;
}
}
public int CompareTo(Option other)
{
if (DisplayName == other.DisplayName)
return 0;
return -1;
}
public bool Equals(Option other)
{
if (other == null)
return false;
return DisplayName == other.DisplayName;
}
public bool Equals(Enum other)
{
if (other == null)
return false;
return DisplayName == other.ToString();
}
public bool Equals(string other)
{
if (string.IsNullOrEmpty(other))
return false;
return DisplayName == other;
}
public override string ToString()
{
return DisplayName;
}
}
}
}
@@ -0,0 +1,10 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class DoubleColumn : EditorDataGridTemplateColumnBase
{
public double Minimun { get; set; }
public double Maximun { get; set; }
public int Resolution { get; set; }
public string InputMode { get; set; }
}
}
@@ -0,0 +1,142 @@
using System;
using System.Windows;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.UI.Client.ClientBase;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class EditorDataGridTemplateColumnBase: ExtendedGrid.Microsoft.Windows.Controls.DataGridTemplateColumn
{
#region Variables
private MenuPermissionEnum _permission;
#endregion
public EditorDataGridTemplateColumnBase()
{
IsReadOnly = false;
IsEnable = true;
IsEditable = true;
_permission = MenuPermissionEnum.MP_NONE;
Visibility = Visibility.Visible;
IsExpander = false;
}
public string ModuleName { get; set; }
public string DisplayName { get; set; }
public string UnitName { get; set; }
public string ControlName { get; set; }
public string Description { get; set; }
public string StringCellTemplate { get; set; }
public string StringCellEditingTemplate { get; set; }
public string StringHeaderTemplate { get; set; }
public bool IsEnable { get; set; }
public bool IsEditable { get; set; }
public bool IgnoreGasFlowCalculate { get; set; }
/// <summary>
/// 返回当前列是否为列扩展器。
/// </summary>
public bool IsExpander { get; protected set; }
public string Default { get; set; }
public bool EnableConfig { get; set; }
public bool EnableTolerance { get; set; }
/// <summary>
/// 设置当前列权限。
/// </summary>
public MenuPermissionEnum Permission
{
get => _permission;
set
{
_permission = value;
UpdateVisibility();
UpdatePermission();
}
}
public bool IsColumnSelected
{
get => (bool)GetValue(IsColumnSelectedProperty);
set => SetValue(IsColumnSelectedProperty, value);
}
/// <summary>
/// The DependencyProperty that represents the IsReadOnly property.
/// </summary>
public static readonly DependencyProperty IsColumnSelectedProperty =
DependencyProperty.Register("IsColumnSelected", typeof(bool), typeof(EditorDataGridTemplateColumnBase), new FrameworkPropertyMetadata(false, OnNotifyCellPropertyChanged));
public Action<Param> PermissionChangedCallback { get; private set; }
public Func<Param,bool> Check { get; set; }
#region Methods
/// <summary>
/// 当前列的权限发生变化时执行的回调函数。
/// </summary>
/// <remarks>
/// 该回调函数中,设置当前列下所有配方参数的访问权限。
/// </remarks>
private void UpdatePermission()
{
switch (Permission)
{
default:
case MenuPermissionEnum.MP_NONE:
PermissionChangedCallback = (p) =>
{
p.ColumnPermission = Permission;
};
break;
case MenuPermissionEnum.MP_READ:
PermissionChangedCallback = (p) =>
{
p.ColumnPermission = Permission;
};
break;
case MenuPermissionEnum.MP_READ_WRITE:
PermissionChangedCallback = (p) =>
{
p.ColumnPermission = Permission;
};
break;
}
}
/// <summary>
/// 根据权限更新当前列的可见状态。
/// </summary>
public void UpdateVisibility()
{
if (!IsExpander)
{
Visibility = _permission == MenuPermissionEnum.MP_NONE
? Visibility.Collapsed
: Visibility.Visible;
}
}
#endregion
}
}
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Windows;
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class ExpanderColumn : EditorDataGridTemplateColumnBase
{
#region Constructors
public ExpanderColumn()
{
IsExpander = true;
ChildColumns = new List<EditorDataGridTemplateColumnBase>();
}
#endregion
#region Properties
public static DependencyProperty IsExpanderProperty = DependencyProperty.Register("IsExpanded", typeof(bool),
typeof(ExpanderColumn), new PropertyMetadata(true));
public bool IsExpanded
{
get => (bool)GetValue(IsExpanderProperty);
set => SetValue(IsExpanderProperty, value);
}
/// <summary>
/// 返回当前组的所有列。
/// </summary>
public List<EditorDataGridTemplateColumnBase> ChildColumns { get; }
#endregion
}
}
@@ -0,0 +1,8 @@
using System.Collections.ObjectModel;
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class FlowModeColumn : ComboxColumn
{
}
}
@@ -0,0 +1,8 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class IntColumn : EditorDataGridTemplateColumnBase
{
public double Minimun { get; set; }
public double Maximun { get; set; }
}
}
@@ -0,0 +1,20 @@
using System.Collections.ObjectModel;
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class LoopComboxColumn : EditorDataGridTemplateColumnBase
{
public LoopComboxColumn() : base()
{
this.Options = new ObservableCollection<Option>();
}
public class Option
{
public string ControlName { get; set; }
public string DisplayName { get; set; }
public string RelatedParameters { get; set; }
}
public ObservableCollection<Option> Options { get; set; }
}
}
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class MultipleSelectColumn : EditorDataGridTemplateColumnBase
{
public MultipleSelectColumn() : base()
{
this.Options = new ObservableCollection<Option>();
}
public class Option
{
public MultipleSelectParam parent { get; set; }
public string ControlName { get; set; }
public string DisplayName { get; set; }
public string RelatedParameters { get; set; }
public bool IsChecked
{
get { return this.isChecked; }
set
{
this.isChecked = value;
if (this.parent != null)
this.parent.IsSaved = false;
}
}
private bool isChecked;
}
public ObservableCollection<Option> Options { get; set; }
public List<Option> CloneOptions(MultipleSelectParam _parent = null)
{
List<Option> opts = new List<Option>();
this.Options.ToList().ForEach(opt =>
{
opts.Add(new Option()
{
parent = _parent,
ControlName = opt.ControlName,
DisplayName = opt.DisplayName,
RelatedParameters = opt.RelatedParameters
});
});
return opts;
}
}
}
@@ -0,0 +1,10 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class NumColumn : EditorDataGridTemplateColumnBase
{
public double Minimun { get; set; }
public double Maximun { get; set; }
public string InputMode { get; set; }
}
}
@@ -0,0 +1,6 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class PopSettingColumn : EditorDataGridTemplateColumnBase
{
}
}
@@ -0,0 +1,13 @@
using System.Collections.ObjectModel;
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class PositionColumn : EditorDataGridTemplateColumnBase
{
public PositionColumn() : base()
{
this.Options = new ObservableCollection<ComboxColumn.Option>();
}
public ObservableCollection<ComboxColumn.Option> Options { get; set; }
}
}
@@ -0,0 +1,10 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
/// <summary>
/// 比例输入列。
/// </summary>
public class RatioColumn : EditorDataGridTemplateColumnBase
{
public int MaxSets { get; set; }
}
}
@@ -0,0 +1,7 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class RecipeSelectColumn : EditorDataGridTemplateColumnBase
{
public string RecipeProcessType { get; set; }
}
}
@@ -0,0 +1,6 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class StepColumn : EditorDataGridTemplateColumnBase
{
}
}
@@ -0,0 +1,6 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class TextBlockColumn : EditorDataGridTemplateColumnBase
{
}
}
@@ -0,0 +1,7 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class TextBoxColumn : EditorDataGridTemplateColumnBase
{
public int MaxLength { get; set; }
}
}
@@ -0,0 +1,6 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class TuneColumn : EditorDataGridTemplateColumnBase
{
}
}
@@ -0,0 +1,6 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn
{
public class VatColumn : EditorDataGridTemplateColumnBase
{
}
}