using System.ComponentModel; using System.Runtime.CompilerServices; using SparkClient.ViewModel.Configuration; namespace SparkClient.Model.Entity; public class AgileJsonConfigEntity { public readonly List Keys; public AgileJsonConfigEntity(List keys) { Shape = "圆形"; Keys = keys; JsonKeys = keys; ModeList = GetRunModelList(); SpceList = GetRunSpecList(); _mode = ModeList.FirstOrDefault(); _spec = SpceList.FirstOrDefault(); } private Param _mode; public Param Mode { get => _mode; set => SetField(ref _mode, value); } private Param _spec; public Param Spec { get => _spec; set => SetField(ref _spec, value); } private string _shape; public string Shape { get => _shape; set => SetField(ref _shape, value); } private string _jsonKey; public string JsonKey { get => _jsonKey; set { SetField(ref _jsonKey, value); } } private string _value; public string Value { get => _value; set => SetField(ref _value, value); } private List _jsonKeys; public List JsonKeys { get => _jsonKeys; set => SetField(ref _jsonKeys, value); } private List _modeList; public List ModeList { get => _modeList; set => SetField(ref _modeList, value); } private List _specList; public List SpceList { get => _specList; set => SetField(ref _specList, value); } public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged([CallerMemberName] string name = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } protected bool SetField(ref T field, T value, [CallerMemberName] string name = null) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; OnPropertyChanged(name); return true; } public List GetRunModelList() { return new List { new Param() { Value = "0", Name = "实验室模式" }, new Param() { Value = "1", Name = "工厂模式" } }; } public List GetRunSpecList() { return new List { new Param() { Value = "P8-P8", Name = "P8-P8" }, new Param() { Value = "P8-P8-S1", Name = "P8-P8-S1" }, new Param() { Value = "P8-P8-S2", Name = "P8-P8-S2" }, new Param() { Value = "P8-P8-S3", Name = "P8-P8-S3" }, new Param() { Value = "P8-P8-S4", Name = "P8-P8-S4" }, new Param() { Value = "P8-P8-S5", Name = "P8-P8-S5" }, new Param() { Value = "P8-P8-S6", Name = "P8-P8-S6" }, new Param() { Value = "P8-P8-S7", Name = "P8-P8-S7" }, new Param() { Value = "P8-P8-S8", Name = "P8-P8-S8" } }; } } public class Param { public string Value { get; set; } public string Name { get; set; } }