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

@@ -44,14 +44,14 @@ namespace TestingModule.ViewModels
get { return _selectedTabHeader; }
set { SetProperty(ref _selectedTabHeader, value); }
}
private List<StepModel> _SelectedItems;
public List<StepModel> SelectedItems
private List<StepVM> _SelectedItems;
public List<StepVM> SelectedItems
{
get { return _SelectedItems; }
set { SetProperty(ref _SelectedItems, value); }
}
private StepModel _SelectedStep;
public StepModel SelectedStep
private StepVM _SelectedStep;
public StepVM SelectedStep
{
get => _SelectedStep;
set
@@ -62,7 +62,7 @@ namespace TestingModule.ViewModels
}
}
}
public ProgramModel Program
public ProgramVM Program
{
get => _ScopedContext.Program;
set
@@ -77,7 +77,7 @@ namespace TestingModule.ViewModels
ScopedContext _ScopedContext { get; set; }
private readonly SystemConfig _systemConfig;
private readonly GlobalInfo _globalInfo;
private List<StepModel> tmpCopyList = new List<StepModel>();
private List<StepVM> tmpCopyList = new List<StepVM>();
#endregion
@@ -115,7 +115,7 @@ namespace TestingModule.ViewModels
var selectedList = parameter as IList;
if (selectedList != null)
{
SelectedItems = selectedList.Cast<StepModel>().ToList();
SelectedItems = selectedList.Cast<StepVM>().ToList();
}
}
@@ -157,7 +157,7 @@ namespace TestingModule.ViewModels
foreach (var item in tmpCopyList)
{
// 创建新副本,避免引用同一个对象,并赋予新 ID
var newStep = new StepModel(item) { ID = Guid.NewGuid() };
var newStep = new StepVM(item) { ID = Guid.NewGuid() };
Program.StepCollection.Insert(insertIndex, newStep);
insertIndex++; // 递增索引,保证粘贴的多项顺序一致
}
@@ -168,7 +168,7 @@ namespace TestingModule.ViewModels
foreach (var item in tmpCopyList)
{
var newStep = new StepModel(item) { ID = Guid.NewGuid() };
var newStep = new StepVM(item) { ID = Guid.NewGuid() };
Program.ErrorStepCollection.Insert(insertIndex, newStep);
insertIndex++;
}
@@ -208,7 +208,7 @@ namespace TestingModule.ViewModels
#region
private void StepCollection_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
var collection = sender as ObservableCollection<StepModel>;
var collection = sender as ObservableCollection<StepVM>;
// Add/Move/Remove 都会触发,这里判断具体情形
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Move||