53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using System;
|
|
using System.Linq;
|
|
using ProductionUiCordonelLegacy.Properties;
|
|
|
|
namespace ProductionUiCordonelLegacy.Data
|
|
{
|
|
/// <summary>
|
|
/// Concatenation of state and string
|
|
/// </summary>
|
|
public static class FinalTestStateInfo
|
|
{
|
|
/// <summary>
|
|
/// Build state information
|
|
/// </summary>
|
|
private static readonly FinalTestStateText[] StateInfos;
|
|
|
|
/// <summary>
|
|
/// Ctor
|
|
/// </summary>
|
|
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;
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the current information
|
|
/// </summary>
|
|
/// <param name="state">state to search for information text</param>
|
|
public static String GetTextFromState(FinalTestState state)
|
|
{
|
|
return (from stateInfo in StateInfos
|
|
where stateInfo.State == state
|
|
select stateInfo.Message).FirstOrDefault();
|
|
}
|
|
/// <summary>
|
|
/// Get the state of the text
|
|
/// </summary>
|
|
/// <param name="text">information text to search if state is assigned</param>
|
|
public static FinalTestState GetStateFromText(String text)
|
|
{
|
|
return (from stateInfo in StateInfos
|
|
where stateInfo.Message == text
|
|
select stateInfo.State).FirstOrDefault();
|
|
}
|
|
}
|
|
}
|