You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
3.7 KiB

using System.ComponentModel;
using System.Runtime.CompilerServices;
using SparkClient.ViewModel.Configuration;
namespace SparkClient.Model.Entity;
public class AgileJsonConfigEntity
{
public readonly List<string> Keys;
public AgileJsonConfigEntity(List<string> 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<string> _jsonKeys;
public List<string> JsonKeys
{
get => _jsonKeys;
set => SetField(ref _jsonKeys, value);
}
private List<Param> _modeList;
public List<Param> ModeList
{
get => _modeList;
set => SetField(ref _modeList, value);
}
private List<Param> _specList;
public List<Param> 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<T>(ref T field, T value, [CallerMemberName] string name = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
field = value;
OnPropertyChanged(name);
return true;
}
public List<Param> GetRunModelList()
{
return new List<Param>
{
new Param()
{
Value = "0",
Name = "实验室模式"
},
new Param()
{
Value = "1",
Name = "工厂模式"
}
};
}
public List<Param> GetRunSpecList()
{
return new List<Param>
{
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; }
}