diff --git a/EasyEplanner.Tests/DFrm.Test.cs b/EasyEplanner.Tests/DFrm.Test.cs index 665e1bb9..16ea4d97 100644 --- a/EasyEplanner.Tests/DFrm.Test.cs +++ b/EasyEplanner.Tests/DFrm.Test.cs @@ -110,7 +110,7 @@ public void AddDevParametersTest() Assert.Multiple(() => { Assert.AreEqual("Параметры", root_v.Nodes[0].Text); - Assert.AreEqual("Параметры времени выполнения", root_v.Nodes[1].Text); + Assert.AreEqual("Рабочие параметры", root_v.Nodes[1].Text); Assert.AreEqual("P_ON_TIME Время включения", root_v.Nodes[0].Nodes[0].Text); Assert.AreEqual("P_FB Обратная связь", root_v.Nodes[0].Nodes[1].Text); Assert.AreEqual("R_AS_NUMBER", root_v.Nodes[1].Nodes[0].Text); diff --git a/src/Configuration/DeviceBindingReader.cs b/src/Configuration/DeviceBindingReader.cs index 497722e2..98b3e130 100644 --- a/src/Configuration/DeviceBindingReader.cs +++ b/src/Configuration/DeviceBindingReader.cs @@ -575,9 +575,14 @@ private void SetBind(string description, List actions, } var devicesGroupingByAS = devices - .GroupBy(dev => dev.RuntimeParameters - .TryGetValue(IODevice.RuntimeParameter.R_AS_NUMBER, out var r_as_number) - ? int.Parse(r_as_number.ToString()) : -1) + .GroupBy(dev => + { + dev.RuntimeParameters.TryGetValue(IODevice.RuntimeParameter.R_AS_NUMBER, + out var r_as_number_str); + if (r_as_number_str != null && int.TryParse(r_as_number_str.ToString(), out var r_as_number)) + return r_as_number; + return -1; + }) .Where(r_as_dev => r_as_dev.Key != -1); foreach (var group in devicesGroupingByAS.Where(r_as_dev => r_as_dev.Count() > 1)) diff --git a/src/DFrm.cs b/src/DFrm.cs index 3bf451a3..3dc33ef6 100644 --- a/src/DFrm.cs +++ b/src/DFrm.cs @@ -791,10 +791,11 @@ private void FillTypeNode(EplanDevice.IODevice dev, Node root, dev.ObjectNumber, devTypeNode); Node devNode = MakeDeviceNode(devTypeNode, devObjectNode, dev, deviceDescription); - bool isDevVisible = AddDevChannels(devNode, dev) || - (displayParamsBtn.Checked && AddDevParametersAndProperties(devNode, dev)); - - HideIncorrectDeviceTypeSubType(devNode, isDevVisible, countDev, + + bool isDevChannelsVisible = AddDevChannels(devNode, dev); + bool isDevParametersVisible = displayParamsBtn.Checked && AddDevParametersAndProperties(devNode, dev); + + HideIncorrectDeviceTypeSubType(devNode, isDevChannelsVisible || isDevParametersVisible, countDev, dev); } @@ -1647,7 +1648,7 @@ private void devicesTreeViewAdv_SizeChanged(object sender, EventArgs e) public const string ParametersNodeName = "Параметры"; - public const string RuntimeParametersNodeName = "Параметры времени выполнения"; + public const string RuntimeParametersNodeName = "Рабочие параметры"; public const string PropertiesNodeName = "Свойства"; }