SparkControl_API/QueryDemo.cs
2025-03-27 16:01:28 +08:00

42 lines
1.3 KiB
C#

using System;
namespace Tecan.At.AutomationInterface.SampleApp
{
internal class QueryDemo
{
[Demo("getMethods", '2')]
public static void GetAllMethods(SampleApp sampleApp, SessionData sessionData)
{
sampleApp.GetMethods(sessionData);
foreach (var methodName in sessionData.AvailableMethods)
{
Console.WriteLine(methodName);
}
}
[Demo("getMethodXml<methodName> <targetFileName>", '3')]
public static void GetMethodByNameAndTarget(SampleApp sampleApp, SessionData sessionData)
{
Console.Write("method name? ");
var methodName = Console.ReadLine();
var xmlString = sampleApp.GetMethodXml(methodName);
if (String.IsNullOrWhiteSpace(xmlString))
{
Console.WriteLine($"Method '{methodName}' not available.");
return;
}
Console.WriteLine($"Loaded method '{methodName}'. Length: '{xmlString.Length}'.");
Console.Write("target file name? ");
var targetFileName = Console.ReadLine();
// Console.WriteLine(xmlString);
System.IO.File.WriteAllText(targetFileName, xmlString);
}
}
}