/// /// Copyright (c) 2021 Sensus Slovensko a.s. /// using System.Collections.Generic; using System.Xml.Serialization; using Common; using Config.Entities; using SchematicDrawing; using TBF.Rig.Generic; namespace TBF.Rig.Various.EmergencyStop { public class Configuration : ComponentCfgBase, IComponentCfg, IParamsProvider, IRouteBasedDrawingItem { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } public IComponentCfgCtrl GetControl(IList cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); } /// /// Serialized parameters /// public Shape Shape { get; set; } public int X { get; set; } public int Y { get; set; } public Sz Sz { get; set; } public Orient Orient { get; set; } public bool Flip { get; set; } public int LblX { get; set; } public int LblY { get; set; } public Orient LblOrient { get; set; } [XmlIgnore] public int BitNr { get { return 81; } } /// Bit-position [XmlIgnore] public bool Inverted { get { return false; } } /// When true the valve function is inverted: 0 = open, 1 = closed [XmlIgnore] public IList GNodes { get; set; } [XmlIgnore] public IList EdgesToSet { get; set; } public Configuration() { GNodes = new List(); EdgesToSet = new List(); } public Configuration(string name, IComponentFactory factory) : this() { Shape = Shape.EmergencyStop; Sz = Sz.XL; Name = name; ParentName = string.Empty; Factory = factory; LblX = 43; LblY = 22; } public string ComponentName { get { return Name; } } public void InitializeAll() { } string[] paramNames = new string[0] { }; public string ParamName(int i) { return paramNames[i]; } public int ParamsCount() { return paramNames.Length; } public ICollection ParamValues(int i) { return null; } public string ToString(int i) { return string.Format("name={0} x={1} y={2} sz={3} orient={4}", Name, X, Y, Sz, Orient); } public CfgUpdateFlags UpdateParam(int i, string strValue) { return CfgUpdateFlags.None; } public bool ValidateParam(int i, string strValue, out string message) { message = "Invalid index"; return false; } void CopyContentTo(Configuration prms) { } public IParamsProvider Clone() { Configuration pars = new Configuration(); CopyContentTo(pars); return pars; } public bool UpdateEmbeddedDbEntity() { return true; /// =OK, do nothing } } }