diff --git a/src/components.pneumatics/src/AXOpen.Components.Pneumatics/AxoCylinder/AxoCylinder.cs b/src/components.pneumatics/src/AXOpen.Components.Pneumatics/AxoCylinder/AxoCylinder.cs index 2ce174cad..77d31a529 100644 --- a/src/components.pneumatics/src/AXOpen.Components.Pneumatics/AxoCylinder/AxoCylinder.cs +++ b/src/components.pneumatics/src/AXOpen.Components.Pneumatics/AxoCylinder/AxoCylinder.cs @@ -23,15 +23,15 @@ private void InitializeMessenger() List> messengerTextList = new List> { new KeyValuePair(0, new AxoMessengerTextItem(" ", " ")), - new KeyValuePair(1, new AxoMessengerTextItem($"Movement position `{this.OutLabel}` did not succeed.", "Check that cylinder is free to move, check the air pressure, and extremity sensor.")), - new KeyValuePair(2, new AxoMessengerTextItem($"Movement position `{this.InLabel}` did not succeed.", "Check that cylinder is free to move, check the air pressure, and extremity sensor.")), + new KeyValuePair(1, new AxoMessengerTextItem(() => $"Movement position `{this.OutLabel}` did not succeed.", "Check that cylinder is free to move, check the air pressure, and extremity sensor.")), + new KeyValuePair(2, new AxoMessengerTextItem(() => $"Movement position `{this.InLabel}` did not succeed.", "Check that cylinder is free to move, check the air pressure, and extremity sensor.")), new KeyValuePair(3, new AxoMessengerTextItem("Both extremity sensors are active at the same time.", "Check the positions of the sensors.")), - new KeyValuePair(4, new AxoMessengerTextItem($"Movement to position `{this.OutLabel}` is temporarily suspended.", "Check the blocking condition.")), - new KeyValuePair(5, new AxoMessengerTextItem($"Movement to position `{this.InLabel}` is temporarily suspended.", "Check the blocking condition.")), - new KeyValuePair(6, new AxoMessengerTextItem($"Movement position `{this.OutLabel}` is aborted.", "Check the blocking condition.")), - new KeyValuePair(7, new AxoMessengerTextItem($"Movement position `{this.InLabel}` is aborted.", "Check the blocking condition.")), - new KeyValuePair(8, new AxoMessengerTextItem($"Movement position `{this.InLabel}` overshot the extremity sensor.", "Check the sensor position.")), - new KeyValuePair(9, new AxoMessengerTextItem($"Movement position `{this.OutLabel}` overshot the extremity sensor.", "Check the sensor position.")), + new KeyValuePair(4, new AxoMessengerTextItem(() => $"Movement to position `{this.OutLabel}` is temporarily suspended.", "Check the blocking condition.")), + new KeyValuePair(5, new AxoMessengerTextItem(() => $"Movement to position `{this.InLabel}` is temporarily suspended.", "Check the blocking condition.")), + new KeyValuePair(6, new AxoMessengerTextItem(() => $"Movement position `{this.OutLabel}` is aborted.", "Check the blocking condition.")), + new KeyValuePair(7, new AxoMessengerTextItem(() => $"Movement position `{this.InLabel}` is aborted.", "Check the blocking condition.")), + new KeyValuePair(8, new AxoMessengerTextItem(() => $"Movement position `{this.InLabel}` overshot the extremity sensor.", "Check the sensor position.")), + new KeyValuePair(9, new AxoMessengerTextItem(() => $"Movement position `{this.OutLabel}` overshot the extremity sensor.", "Check the sensor position.")), }; _Messenger.DotNetMessengerTextList = messengerTextList; diff --git a/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessenger.cs b/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessenger.cs index 090bc5822..cf9687b90 100644 --- a/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessenger.cs +++ b/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessenger.cs @@ -136,8 +136,8 @@ public Dictionary PlcMessengerTextList private List> dotNetMessengerTextList; public List> DotNetMessengerTextList { - get{return dotNetMessengerTextList != null ? dotNetMessengerTextList : new List>();} - set{dotNetMessengerTextList = value != null ? value : new List>(); } + get{ return dotNetMessengerTextList != null ? dotNetMessengerTextList : new List>(); } + set{ dotNetMessengerTextList = value != null ? value : new List>(); } } diff --git a/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessengerTextItem.cs b/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessengerTextItem.cs index 6b66b9490..114aa2403 100644 --- a/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessengerTextItem.cs +++ b/src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessengerTextItem.cs @@ -9,14 +9,47 @@ namespace AXOpen.Messaging.Static; public class AxoMessengerTextItem { - public string MessageText { get; } - public string HelpText { get; } + public Func MessageTextExpression { get; set; } + public Func HelpTextExpression { get; set; } + + private string _messageText; + public string MessageText + { + get { + if(_messageText is null && MessageTextExpression is not null) + { + return MessageTextExpression.Invoke(); + } + return _messageText; + } + + private set + { + _messageText = value; + } + } + + private string _helpText; + public string HelpText { get { return _helpText; } private set { _helpText = value; } } public AxoMessengerTextItem(string messageText, string helpText) { MessageText = messageText; HelpText = helpText; } + + public AxoMessengerTextItem(Func messageTextExpression, Func helpTextExpression) + { + MessageTextExpression = messageTextExpression; + HelpTextExpression = helpTextExpression; + } + + public AxoMessengerTextItem(Func messageTextExpression, string helpText) + { + MessageTextExpression = messageTextExpression; + HelpText = helpText; + } + public AxoMessengerTextItem(string messageText) { MessageText = messageText;