Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ private void InitializeMessenger()
List<KeyValuePair<ulong, AxoMessengerTextItem>> messengerTextList = new List<KeyValuePair<ulong, AxoMessengerTextItem>>
{
new KeyValuePair<ulong, AxoMessengerTextItem>(0, new AxoMessengerTextItem(" ", " ")),
new KeyValuePair<ulong, AxoMessengerTextItem>(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<ulong, AxoMessengerTextItem>(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<ulong, AxoMessengerTextItem>(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<ulong, AxoMessengerTextItem>(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<ulong, AxoMessengerTextItem>(3, new AxoMessengerTextItem("Both extremity sensors are active at the same time.", "Check the positions of the sensors.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(4, new AxoMessengerTextItem($"Movement to position `{this.OutLabel}` is temporarily suspended.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(5, new AxoMessengerTextItem($"Movement to position `{this.InLabel}` is temporarily suspended.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(6, new AxoMessengerTextItem($"Movement position `{this.OutLabel}` is aborted.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(7, new AxoMessengerTextItem($"Movement position `{this.InLabel}` is aborted.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(8, new AxoMessengerTextItem($"Movement position `{this.InLabel}` overshot the extremity sensor.", "Check the sensor position.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(9, new AxoMessengerTextItem($"Movement position `{this.OutLabel}` overshot the extremity sensor.", "Check the sensor position.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(4, new AxoMessengerTextItem(() => $"Movement to position `{this.OutLabel}` is temporarily suspended.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(5, new AxoMessengerTextItem(() => $"Movement to position `{this.InLabel}` is temporarily suspended.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(6, new AxoMessengerTextItem(() => $"Movement position `{this.OutLabel}` is aborted.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(7, new AxoMessengerTextItem(() => $"Movement position `{this.InLabel}` is aborted.", "Check the blocking condition.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(8, new AxoMessengerTextItem(() => $"Movement position `{this.InLabel}` overshot the extremity sensor.", "Check the sensor position.")),
new KeyValuePair<ulong, AxoMessengerTextItem>(9, new AxoMessengerTextItem(() => $"Movement position `{this.OutLabel}` overshot the extremity sensor.", "Check the sensor position.")),
};

_Messenger.DotNetMessengerTextList = messengerTextList;
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/AXOpen.Core/AxoMessenger/Static/AxoMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public Dictionary<ulong, AxoMessengerTextItem> PlcMessengerTextList
private List<KeyValuePair<ulong, AxoMessengerTextItem>> dotNetMessengerTextList;
public List<KeyValuePair<ulong, AxoMessengerTextItem>> DotNetMessengerTextList
{
get{return dotNetMessengerTextList != null ? dotNetMessengerTextList : new List<KeyValuePair<ulong, AxoMessengerTextItem>>();}
set{dotNetMessengerTextList = value != null ? value : new List<KeyValuePair<ulong, AxoMessengerTextItem>>(); }
get{ return dotNetMessengerTextList != null ? dotNetMessengerTextList : new List<KeyValuePair<ulong, AxoMessengerTextItem>>(); }
set{ dotNetMessengerTextList = value != null ? value : new List<KeyValuePair<ulong, AxoMessengerTextItem>>(); }
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,47 @@ namespace AXOpen.Messaging.Static;

public class AxoMessengerTextItem
{
public string MessageText { get; }
public string HelpText { get; }
public Func<string> MessageTextExpression { get; set; }
public Func<string> 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<string> messageTextExpression, Func<string> helpTextExpression)
{
MessageTextExpression = messageTextExpression;
HelpTextExpression = helpTextExpression;
}

public AxoMessengerTextItem(Func<string> messageTextExpression, string helpText)
{
MessageTextExpression = messageTextExpression;
HelpText = helpText;
}

public AxoMessengerTextItem(string messageText)
{
MessageText = messageText;
Expand Down
Loading