using System;
using System.Linq;
using ProductionUiCordonelLegacy.Properties;
namespace ProductionUiCordonelLegacy.Data
{
///
/// Concatenation of state and string
///
public static class FinalTestStateInfo
{
///
/// Build state information
///
private static readonly FinalTestStateText[] StateInfos;
///
/// Ctor
///
static FinalTestStateInfo()
{
StateInfos = new FinalTestStateText[(Int32)FinalTestState.StateListDelimiter];
StateInfos[(Int32)FinalTestState.Idle].State = FinalTestState.Idle;
StateInfos[(Int32)FinalTestState.Idle].Message = Resources.StrStateIdle;
StateInfos[(Int32)FinalTestState.StartInitial].State = FinalTestState.StartInitial;
StateInfos[(Int32)FinalTestState.StartInitial].Message = Resources.StrStateStartInitial;
}
///
/// Get the current information
///
/// state to search for information text
public static String GetTextFromState(FinalTestState state)
{
return (from stateInfo in StateInfos
where stateInfo.State == state
select stateInfo.Message).FirstOrDefault();
}
///
/// Get the state of the text
///
/// information text to search if state is assigned
public static FinalTestState GetStateFromText(String text)
{
return (from stateInfo in StateInfos
where stateInfo.Message == text
select stateInfo.State).FirstOrDefault();
}
}
}