So durchsuchen Sie den Auftrag
internal class Program
{
private static async Task Main(string[] args)
{
const string filename = @"d:\temp\example_data.padfx";
using (var padfx = Channel.Padfx.Open(filename))
{
// read workspace
var info = (await padfx.GetWorkspaces()).FirstOrDefault();
var workspace = await padfx.DownloadWorkspace(info);
// traverse structure object which have tests
foreach (var structureObject in workspace.StructureObjects.Flatten().Where(_ => _.HasTests))
{
Console.WriteLine($"Structure object = {structureObject.Info.Name}; Has {structureObject.Children.Count} children.");
// read all measurements from structure object
foreach (var measurement in structureObject.AllMeasurements)
{
Console.WriteLine($"Measurement = {measurement.Info.Name}");
}
// read all tests from structure object
foreach (var test in structureObject.Tests)
{
switch (test)
{
case SingleTest singleTest:
Console.WriteLine($"Measurement = {singleTest.Measurement.Info.Name}");
break;
case PredefinedInspection inspection:
Console.WriteLine($"Inspection = {inspection.Info.Name}");
break;
case CustomInspection customInspection:
Console.WriteLine($"Custom inspection = {customInspection.Name}");
break;
case AutoSequence sequence:
Console.WriteLine($"Auto sequence = {sequence.Header.Name}");
break;
}
}
}
}
}
}
C#