using Aurora.Api; using AuroraACS.Views; using PropertyTools.DataAnnotations; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace AuroraACS { public class ACSDeviceSetting : ISettingItem { [InputFilePath] public string HelpImagePath { get; set; } public BufferInfoCollection BufferInfoList { get; set; } = new BufferInfoCollection(); public VariableValueCollection VariableValueList { get; set; } = new VariableValueCollection(); } public class BufferInfoCollection : ObservableCollection { public BufferInfoCollection() { } public BufferInfoCollection(IEnumerable collection) : base(collection) { } public BufferInfoCollection(List list) : base(list) { } public string this[Enum index] { get => base[Convert.ToInt32(index)].Label; } public int this[string Label] { get => this.FirstOrDefault(t => t.Label == Label).BufferNo; } } public class BufferInfo { public int BufferNo { get; set; } = -1; public string Description { get; set; } = string.Empty; public string Label { get; set; } = string.Empty; } public class VariableValueCollection : ObservableCollection { public VariableValueCollection() { } public VariableValueCollection(IEnumerable collection) : base(collection) { } public VariableValueCollection(List list) : base(list) { } public string this[Enum index] { get => base[Convert.ToInt32(index)].VariableValueName; } } public class VariableValue { public int Index { get; set; } public string VariableValueName { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string DataType { get; set; } = "R"; public string Authority { get; set; } = string.Empty; public bool IsSelectReference { get; set; } = false; public int ReferenceBuffer { get; set; } = -1; public double Value { get; set; } = -1; } }