automapper框架优化

This commit is contained in:
hsc
2026-06-10 15:04:11 +08:00
parent 5452857299
commit 2e07c0c446
43 changed files with 612 additions and 293 deletions

View File

@@ -15,7 +15,7 @@ namespace UIShare.GlobalVariable
public class ScopedContext
{
private static readonly Random _randomSeed = new Random();
public ProgramModel Program { get; set; } = new();
public ProgramVM Program { get; set; } = new();
public String SelectedStepList { get; set; } = "主程序";
public string CurrentFilePath { get; set; }
public bool? IsStop { get; set; }
@@ -26,8 +26,8 @@ namespace UIShare.GlobalVariable
public bool IsTerminate { get; set; } = false;
public ObservableCollection<Assembly> Assemblies { get; set; } = new();
public PackIconKind RunIcon { get; set; } = PackIconKind.Play;
public StepModel SelectedStep { get; set; }
public ParameterModel SelectedParameter { get; set; }
public StepVM SelectedStep { get; set; }
public ParameterVM SelectedParameter { get; set; }
public List<IBaseInterface> DeviceList { get; set; } = new();
// 【新增测试属性】:每个实例被 new 出来时独一无二的随机身份

View File

@@ -13,7 +13,7 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UIShare.GlobalVariable;
using static UIShare.UIViewModel.ParameterModel;
using static UIShare.UIViewModel.ParameterVM;
namespace UIShare
@@ -26,7 +26,7 @@ namespace UIShare
private IContainerProvider containerProvider;
private IEventAggregator _eventAggregator;
private readonly Dictionary<Guid, ParameterModel> tmpParameters = [];
private readonly Dictionary<Guid, ParameterVM> tmpParameters = [];
private readonly Stopwatch stepStopwatch = new();
@@ -46,7 +46,7 @@ namespace UIShare
_eventAggregator = eventAggregator;
//_devices = containerProvider.Resolve<Devices>();
}
public async Task<bool> ExecuteErrorSteps(ProgramModel program, int depth = 0, CancellationToken cancellationToken = default)
public async Task<bool> ExecuteErrorSteps(ProgramVM program, int depth = 0, CancellationToken cancellationToken = default)
{
int index = 0;
bool stepSuccess = false;
@@ -211,7 +211,7 @@ namespace UIShare
return loopStack.Count == 0 && stepSuccess;
}
public async Task<bool> ExecuteSteps(ProgramModel program, int depth = 0, CancellationToken cancellationToken = default)
public async Task<bool> ExecuteSteps(ProgramVM program, int depth = 0, CancellationToken cancellationToken = default)
{
int index = 0;
bool stepSuccess = false;
@@ -388,7 +388,7 @@ namespace UIShare
return loopStack.Count == 0 && stepSuccess;
}
public async Task ExecuteMethodStep(StepModel step, Dictionary<Guid, ParameterModel> parameters, int depth, CancellationToken cancellationToken = default)
public async Task ExecuteMethodStep(StepVM step, Dictionary<Guid, ParameterVM> parameters, int depth, CancellationToken cancellationToken = default)
{
try
{
@@ -417,7 +417,7 @@ namespace UIShare
// 3. 准备参数
var inputParams = new List<object?>();
var paramTypes = new List<Type>();
ParameterModel? outputParam = null;
ParameterVM? outputParam = null;
foreach (var param in step.Method!.Parameters)
{
if (param.Category == ParameterCategory.Input)
@@ -656,7 +656,7 @@ namespace UIShare
}
}
public void ResetAllStepStatus(ObservableCollection<StepModel> StepCollection)
public void ResetAllStepStatus(ObservableCollection<StepVM> StepCollection)
{
foreach (var step in StepCollection)
{
@@ -665,7 +665,7 @@ namespace UIShare
}
}
private void UpdateCurrentStepResult(StepModel step, bool paraResult = true, bool stepResult = true, int depth = 0)
private void UpdateCurrentStepResult(StepVM step, bool paraResult = true, bool stepResult = true, int depth = 0)
{
if (stepResult && paraResult)
{
@@ -721,7 +721,7 @@ namespace UIShare
public int LoopCount { get; set; }
public int CurrentLoop { get; set; }
public int StartIndex { get; set; }
public StepModel? LoopStartStep { get; set; }
public StepVM? LoopStartStep { get; set; }
}
#endregion

View File

@@ -26,10 +26,10 @@ namespace UIShare.GlobalVariable
public string DefaultProgramFilePath { get; set; } = "";
public string DefaultBLFFilePath { get; set; } = "";
public string DefaultDBCFilePath { get; set; } = "";
public ObservableCollection<DeviceInfoModel> DeviceList = new();
// public ObservableCollection<DeviceInfoModel> DeviceList { get; set; } = new()
public ObservableCollection<DeviceInfoVM> DeviceList = new();
// public ObservableCollection<DeviceInfoVM> DeviceList { get; set; } = new()
//{
// new DeviceInfoModel
// new DeviceInfoVM
// {
// DeviceName = "IT7800E",
// DeviceType = "IT7800E",
@@ -39,7 +39,7 @@ namespace UIShare.GlobalVariable
// IsConnected = false
// },
// new DeviceInfoModel
// new DeviceInfoVM
// {
// DeviceName = "N36200",
// DeviceType = "N36200",
@@ -49,7 +49,7 @@ namespace UIShare.GlobalVariable
// IsConnected = false
// },
// new DeviceInfoModel
// new DeviceInfoVM
// {
// DeviceName = "N36600",
// DeviceType = "N36600",
@@ -59,7 +59,7 @@ namespace UIShare.GlobalVariable
// IsConnected = false
// },
// new DeviceInfoModel
// new DeviceInfoVM
// {
// DeviceName = "N69200",
// DeviceType = "N69200",
@@ -69,7 +69,7 @@ namespace UIShare.GlobalVariable
// IsConnected = false
// },
// new DeviceInfoModel
// new DeviceInfoVM
// {
// DeviceName = "SDS2000X_HD",
// DeviceType = "SDS2000X_HD",
@@ -79,7 +79,7 @@ namespace UIShare.GlobalVariable
// IsConnected = false
// },
// new DeviceInfoModel
// new DeviceInfoVM
// {
// DeviceName = "SPAW7000",
// DeviceType = "SPAW7000",