Generic Method For Text Library
Posted: Tue Feb 03, 2015 9:22 am
In the past, I got a generic method to access or get Tags as seen below,
public GlobalDataItem GetGlobalDataItem(string propertyName)
{
PropertyInfo tagProperty = typeof(Neo.ApplicationFramework.Generated.Tags).GetProperty(propertyName);
if(tagProperty == null)
{
return null;
}
else
{
return tagProperty.GetValue(Globals.Tags, null) as GlobalDataItem;
}
}
Now I want to do the same but this time using the TextLibrary, in where I pass the name of the group so I can do the following comparisoon
for(int m = 0; m < Globals.TextLibrary.XXX.Messages.Count; m++)
{
if((xValue >= Globals.TextLibrary.XXX.Messages[m].StartValue) && (xValue <= Globals.TextLibrary.XXX.Messages[m].EndValue))
{
xMessage = Globals.TextLibrary.XXX.Messages[m].Message;
break;
}
else
{
xMessage = "Unrecognized -" + xValue;
}
}
public GlobalDataItem GetGlobalDataItem(string propertyName)
{
PropertyInfo tagProperty = typeof(Neo.ApplicationFramework.Generated.Tags).GetProperty(propertyName);
if(tagProperty == null)
{
return null;
}
else
{
return tagProperty.GetValue(Globals.Tags, null) as GlobalDataItem;
}
}
Now I want to do the same but this time using the TextLibrary, in where I pass the name of the group so I can do the following comparisoon
for(int m = 0; m < Globals.TextLibrary.XXX.Messages.Count; m++)
{
if((xValue >= Globals.TextLibrary.XXX.Messages[m].StartValue) && (xValue <= Globals.TextLibrary.XXX.Messages[m].EndValue))
{
xMessage = Globals.TextLibrary.XXX.Messages[m].Message;
break;
}
else
{
xMessage = "Unrecognized -" + xValue;
}
}