protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "composite") { return(null); } CompositeDisplay result = new CompositeDisplay { X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"], Height = element["object"]["height"], }; foreach (var i in element["children"]) { DisplayControl ctrl = DisplayControl.CreateControl(config, i); if (ctrl != null) { result.Controls.Add(ctrl); } } return(result); }
public void ADL_Debug_LoadConfig_Test() { ADLConfig config = ConfigManager.GetDefault <ADLConfig>(); Debug.LoadConfig(config); Assert.True(Debug.AdlEnabled == config.AdlEnabled); }
protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "choice button") { return(null); } ChoiceButtonDisplay result = new ChoiceButtonDisplay { X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"], Height = element["object"]["height"], }; if (element["control"] != null && element["control"]["clr"] != null) { result.Color = "#" + config["color map"]["colors"].Childs[element["control"]["clr"]]; } if (element["control"] != null && element["control"]["bclr"] != null) { result.BackgroundColor = "#" + config["color map"]["colors"].Childs[element["control"]["bclr"]]; } if (element["control"] != null && element["control"]["chan"] != null) { result.ChannelName = element["control"]["chan"]; } return(result); }
override protected DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "text") { return(null); } TextDisplay result = new TextDisplay { Text = element["textix"], X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"], Height = element["object"]["height"], Align = "left" }; if (element["align"] != null) { if (element["align"].Value.Contains("right")) { result.Align = "right"; } else if (element["align"].Value.Contains("centered")) { result.Align = "center"; } } if (element["basic attribute"] != null && element["basic attribute"]["clr"] != null) { result.Color = "#" + config["color map"]["colors"].Childs[int.Parse(element["basic attribute"]["clr"].Value)].Value; } return(result); }
protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "text update") { return(null); } TextMonitorDisplay result = new TextMonitorDisplay { ChannelName = element["monitor"]["chan"], X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"], Height = element["object"]["height"], Align = "left", Precision = -1, Exponential = false, ColorMode = ColorMode.STATIC }; if (element["align"] != null) { if (element["align"].Value.Contains("right")) { result.Align = "right"; } else if (element["align"].Value.Contains("centered")) { result.Align = "center"; } } if (element["limits"] != null && element["limits"]["precDefault"] != null) { result.Precision = element["limits"]["precDefault"]; } if (element["format"] != null && element["format"].Value == "exponential") { result.Exponential = true; } if (element["monitor"] != null && element["monitor"]["clr"] != null) { result.Color = "#" + config["color map"]["colors"].Childs[int.Parse(element["monitor"]["clr"].Value)].Value; } if (element["monitor"] != null && element["monitor"]["bclr"] != null) { result.BackgroundColor = "#" + config["color map"]["colors"].Childs[int.Parse(element["monitor"]["bclr"].Value)].Value; } if (element["clrmod"] != null && element["clrmod"].Value == "alarm") { result.ColorMode = ColorMode.ALARM; } return(result); }
protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "polyline" && element.Name != "polygon") { return(null); } PolylineDisplay result = new PolylineDisplay { X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"] + 1, Height = element["object"]["height"] + 1, Fill = "solid", Points = new List <Point>() }; if (element["basic attribute"] != null) { if (element["basic attribute"]["clr"] != null) { result.Color = "#" + config["color map"]["colors"].Childs[element["basic attribute"]["clr"]]; } if (element["basic attribute"]["style"] != null) { result.Style = element["basic attribute"]["style"]; } if (element["basic attribute"]["fill"] != null) { result.Fill = element["basic attribute"]["fill"]; } if (element["basic attribute"]["width"] != null) { result.StrokeWidth = element["basic attribute"]["width"]; } } if (element["dynamic attribute"] != null && element["dynamic attribute"]["clr"] != null && element["dynamic attribute"]["clr"] == "alarm") { result.ColorAlarmChannel = element["dynamic attribute"]["chan"]; } if (element.Name == "polyline") { result.Fill = "outline"; } foreach (var i in element["points"]) { result.Points.Add((Point)i); } return(result); }
protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "arc") { return(null); } ArcDisplay result = new ArcDisplay { X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"], Height = element["object"]["height"], Fill = "solid" }; if (element["basic attribute"] != null) { if (element["basic attribute"]["clr"] != null) { result.Color = "#" + config["color map"]["colors"].Childs[element["basic attribute"]["clr"]]; } if (element["basic attribute"]["style"] != null) { result.Style = element["basic attribute"]["style"]; } if (element["basic attribute"]["fill"] != null) { result.Fill = element["basic attribute"]["fill"]; } if (element["basic attribute"]["width"] != null) { result.StrokeWidth = element["basic attribute"]["width"]; } } if (element["dynamic attribute"] != null && element["dynamic attribute"]["clr"] != null && element["dynamic attribute"]["clr"] == "alarm") { result.ColorAlarmChannel = element["dynamic attribute"]["chan"]; } if (element["begin"] != null) { result.Start = (Math.PI * 2.0 * (double)element["begin"] / 23040.0); } if (element["path"] != null) { result.End = (Math.PI * 2.0 * (double)element["path"] / 23040.0); } return(result); }
protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "byte") { return(null); } return(new ByteDisplay { X = int.Parse(element["object"]["x"].Value), Y = int.Parse(element["object"]["y"].Value), Width = int.Parse(element["object"]["width"].Value), Height = int.Parse(element["object"]["height"].Value), ChannelName = element["monitor"]["chan"].Value, OkValue = element["sbit"].Value, OkColor = "#" + config["color map"]["colors"].Childs[int.Parse(element["monitor"]["clr"].Value)].Value, ErrorColor = "#" + config["color map"]["colors"].Childs[int.Parse(element["monitor"]["bclr"].Value)].Value, }); }
protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "related display") { return(null); } RelatedDisplay result = new RelatedDisplay { X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"], Height = element["object"]["height"], }; if (element["clr"] != null) { result.Color = "#" + config["color map"]["colors"].Childs[element["clr"]]; } if (element["bclr"] != null) { result.BackgroundColor = "#" + config["color map"]["colors"].Childs[element["bclr"]]; } result.Label = element["label"]; List <DisplayOption> options = new List <DisplayOption>(); for (int i = 0; ; i++) { if (element["display[" + i + "]"] == null) { break; } options.Add(new DisplayOption { Label = (string)element["display[" + i + "]"]["label"], Panel = (string)element["display[" + i + "]"]["name"], Arguments = (string)element["display[" + i + "]"]["args"], }); } result.Options = options.ToArray(); return(result); }
protected override DisplayControl ADLConfig(ADLConfig config, ADLElement element) { if (element.Name != "oval") { return(null); } OvalDisplay result = new OvalDisplay { X = element["object"]["x"], Y = element["object"]["y"], Width = element["object"]["width"] + 1, Height = element["object"]["height"] + 1, Fill = "solid", }; if (element["basic attribute"] != null) { if (element["basic attribute"]["clr"] != null) { result.Color = "#" + config["color map"]["colors"].Childs[element["basic attribute"]["clr"]]; } if (element["basic attribute"]["style"] != null) { result.Style = element["basic attribute"]["style"]; } if (element["basic attribute"]["fill"] != null) { result.Fill = element["basic attribute"]["fill"]; } if (element["basic attribute"]["width"] != null) { result.StrokeWidth = element["basic attribute"]["width"]; } } if (element["dynamic attribute"] != null && element["dynamic attribute"]["clr"] != null && element["dynamic attribute"]["clr"] == "alarm") { result.ColorAlarmChannel = element["dynamic attribute"]["chan"]; } return(result); }