93 lines
2.6 KiB
C#
93 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Tecan.At.AutomationInterface.SampleApp
|
|
{
|
|
public enum AutomationInterfaceActions
|
|
{
|
|
Undefined,
|
|
GetInstrument,
|
|
GetAllMethods,
|
|
GetMethod,
|
|
CheckMethod,
|
|
ExecuteMethod,
|
|
PlateOut,
|
|
PlateIn,
|
|
ExportData,
|
|
ClearSession,
|
|
StartWorkflow
|
|
}
|
|
|
|
public class InputData
|
|
{
|
|
public AutomationInterfaceActions Action { get; private set; }
|
|
public List<string> Parameter { get; } = new List<string>();
|
|
|
|
public bool Parse(string value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
return false;
|
|
|
|
string[] parts = value.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
if (!GetAction(parts[0]))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (int i = 1; i < parts.Length; i++)
|
|
{
|
|
Parameter.Add(parts[i]);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
private bool GetAction(string part)
|
|
{
|
|
if (!part.StartsWith("-"))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
switch (part.ToLower())
|
|
{
|
|
case "-getinstrument":
|
|
Action = AutomationInterfaceActions.GetInstrument;
|
|
break;
|
|
case "-getallmethods":
|
|
Action = AutomationInterfaceActions.GetAllMethods;
|
|
break;
|
|
case "-getmethod":
|
|
Action = AutomationInterfaceActions.GetMethod;
|
|
break;
|
|
case "-checkmethod":
|
|
Action = AutomationInterfaceActions.CheckMethod;
|
|
break;
|
|
case "-executemethod":
|
|
Action = AutomationInterfaceActions.ExecuteMethod;
|
|
break;
|
|
case "-plateout":
|
|
Action = AutomationInterfaceActions.PlateOut;
|
|
break;
|
|
case "-platein":
|
|
Action = AutomationInterfaceActions.PlateIn;
|
|
break;
|
|
case "-exportdata":
|
|
Action = AutomationInterfaceActions.ExportData;
|
|
break;
|
|
case "-clearsession":
|
|
Action = AutomationInterfaceActions.ClearSession;
|
|
break;
|
|
case "-startworkflow":
|
|
Action = AutomationInterfaceActions.StartWorkflow;
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|