95 lines
3.3 KiB
C#
95 lines
3.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Tecan.At.Dragonfly.AutomationInterface;
|
|
using Tecan.At.Dragonfly.AutomationInterface.Data;
|
|
using Tecan.At.Dragonfly.AutomationInterface.MethodModification;
|
|
|
|
namespace Tecan.At.AutomationInterface.SampleApp
|
|
{
|
|
public static class AutomationInterfaceAccess
|
|
{
|
|
public static IReadOnlyCollection<IInstrument> GetInstruments()
|
|
{
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
return ai.InstrumentManagement.GetInstruments();
|
|
}
|
|
}
|
|
|
|
public static List<string> GetMethods()
|
|
{
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
return ai.Queries.GetMethods().ToList();
|
|
}
|
|
}
|
|
|
|
public static string GetMethodXml(string methodName)
|
|
{
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
return ai.Queries.GetMethodXml(methodName);
|
|
}
|
|
}
|
|
|
|
public static bool CheckMethod(IInstrument selectedInstrument, string methodAsXml, string methodName, out IEnumerable<string> messages)
|
|
{
|
|
messages = null;
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
return ai.MethodExecution.CheckMethod(selectedInstrument, methodAsXml, methodName, out messages);
|
|
}
|
|
}
|
|
|
|
public static IMethodExecutionResult ExecuteMethod(IInstrument selectedInstrument, string methodAsXml, string methodName, bool isStacker)
|
|
{
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
return ai.MethodExecution.ExecuteMethod(selectedInstrument, methodAsXml, methodName, isStacker);
|
|
}
|
|
}
|
|
|
|
public static Task<IMethodExecutionResult> ExecuteMethodAsync(IInstrument selectedInstrument, string methodAsXml, string methodName, bool isStacker)
|
|
{
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
return ai.MethodExecution.ExecuteMethodAsync(selectedInstrument, methodAsXml, methodName, isStacker);
|
|
}
|
|
}
|
|
|
|
public static void CancelAsyncMethodExecution(IInstrument selectedInstrument)
|
|
{
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
ai.MethodExecution.Cancel(selectedInstrument);
|
|
}
|
|
}
|
|
|
|
public static string ExportData(Guid workspaceId, Guid executionId)
|
|
{
|
|
using (var ai = AutomationInterfaceFactory.Build())
|
|
{
|
|
return ai.MethodExecution.GetResults(workspaceId, executionId);
|
|
}
|
|
}
|
|
|
|
public static string ChangePlateLayout(string methodAsXml, int[] wellsToSelect)
|
|
{
|
|
using (var plateLayoutModifier = MethodModificationFactory.Build<IModifyPlateLayout>(ref methodAsXml))
|
|
{
|
|
var plateInfo = plateLayoutModifier.GetPlateInfo();
|
|
for (uint wellIndex = 0; wellIndex < plateInfo.WellAmount; wellIndex++)
|
|
{
|
|
plateLayoutModifier.SelectWell(wellIndex, wellsToSelect.Any(x => x == wellIndex));
|
|
}
|
|
|
|
methodAsXml = plateLayoutModifier.ApplyChangesToXmlString();
|
|
}
|
|
|
|
return methodAsXml;
|
|
}
|
|
}
|
|
}
|