using Newtonsoft.Json; using Prism.Mvvm; // 引入 Prism 的 BindableBase using System; namespace UIShare.UIViewModel { public class StepVM : BindableBase { #region 构造函数 public StepVM() { } public StepVM(StepVM source) { if (source == null) return; ID = source.ID; Index = source.Index; Name = source.Name; StepType = source.StepType; LoopCount = source.LoopCount; LoopStartStepId = source.LoopStartStepId; OKExpression = source.OKExpression; OKGotoStepID = source.OKGotoStepID; GotoSettingString = source.GotoSettingString; NGGotoStepID = source.NGGotoStepID; Description = source.Description; IsUsed = source.IsUsed; if (source.Method != null) { Method = new MethodVM(source.Method); } if (source.SubProgram != null) { SubProgram = new ProgramVM(source.SubProgram); } } #endregion private Guid _id = Guid.NewGuid(); public Guid ID { get => _id; set => SetProperty(ref _id, value); } private bool _isUsed = true; public bool IsUsed { get => _isUsed; set => SetProperty(ref _isUsed, value); } private int _index; public int Index { get => _index; set => SetProperty(ref _index, value); } private string? _name; public string? Name { get => _name; set => SetProperty(ref _name, value); } private string? _stepType; public string? StepType { get => _stepType; set => SetProperty(ref _stepType, value); } private MethodVM? _method; public MethodVM? Method { get => _method; set => SetProperty(ref _method, value); } private ProgramVM? _subProgram; public ProgramVM? SubProgram { get => _subProgram; set => SetProperty(ref _subProgram, value); } private int? _loopCount; public int? LoopCount { get => _loopCount; set => SetProperty(ref _loopCount, value); } [JsonIgnore] private int? _currentLoopCount; [JsonIgnore] public int? CurrentLoopCount { get => _currentLoopCount; set => SetProperty(ref _currentLoopCount, value); } private Guid? _loopStartStepId; public Guid? LoopStartStepId { get => _loopStartStepId; set => SetProperty(ref _loopStartStepId, value); } [JsonIgnore] private int _result = -1; [JsonIgnore] public int Result { get => _result; set => SetProperty(ref _result, value); } [JsonIgnore] private int? _runTime; [JsonIgnore] public int? RunTime { get => _runTime; set => SetProperty(ref _runTime, value); } private string? _okExpression; public string? OKExpression { get => _okExpression; set => SetProperty(ref _okExpression, value); } private string _gotoSettingString = ""; public string GotoSettingString { get => _gotoSettingString; set => SetProperty(ref _gotoSettingString, value); } private Guid? _okGotoStepID; public Guid? OKGotoStepID { get => _okGotoStepID; set => SetProperty(ref _okGotoStepID, value); } private Guid? _ngGotoStepID; public Guid? NGGotoStepID { get => _ngGotoStepID; set => SetProperty(ref _ngGotoStepID, value); } private string? _description; public string? Description { get => _description; set => SetProperty(ref _description, value); } } }