Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix displaying runtime parameters #1401

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EasyEplanner.Tests/DFrm.Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 8 additions & 3 deletions src/Configuration/DeviceBindingReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,14 @@ private void SetBind(string description, List<string> 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))
Expand Down
11 changes: 6 additions & 5 deletions src/DFrm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 = "Свойства";
}
Expand Down