recipe name filter

This commit is contained in:
meelstorm
2025-07-28 09:52:29 +02:00
parent 71d59df0cd
commit f80b275ad8
58 changed files with 4066 additions and 79 deletions

View File

@@ -30,7 +30,7 @@ namespace VisionBuilder.UI.Recipes.HawkeyeRecipe
_loadingService.StartLoading($"Loading recipes for {_recognitionConfiguration.CameraName}...");
try
{
var files = WorkflowRecipeHelper.ListRecipeFiles();
var files = WorkflowRecipeHelper.ListRecipeFiles(_recognitionConfiguration.RecipeNameFilter);
List<RecipeData> recipes = new List<RecipeData>();
foreach (var file in files)
{
@@ -65,6 +65,7 @@ namespace VisionBuilder.UI.Recipes.HawkeyeRecipe
}
public bool IsRunning { get; set; }
public bool IsPaused { get; set; }
private DateTime _startTime;
private WorkflowList _workflow;
@@ -127,13 +128,27 @@ namespace VisionBuilder.UI.Recipes.HawkeyeRecipe
}
private void Loop(CancellationToken token)
public void Pause()
{
IsPaused= true;
}
public void Resume()
{
IsPaused = false;
}
private async Task Loop(CancellationToken token)
{
// Start the recognition process using the Hawkeye library
while (!token.IsCancellationRequested)
{
if (IsPaused)
{
await Task.Delay(100, token);
continue;
}
var sw = Stopwatch.StartNew();
_workflow.Context.CancellationToken= token;

View File

@@ -13,8 +13,10 @@ public class HawkeyeRecognitionSettings: ISettings
}
public int MinimumProcessingTime { get; set; }
public string RecipeNameFilter { get; set; } = "*";
public void RegisterSettings(InspectronSettings settings)
{
settings.RegisterSimple(this, () => this.MinimumProcessingTime, CameraName+"/Hawkeye recognition", "Minimum processing time (ms)");
settings.RegisterSimple(this, () => this.RecipeNameFilter, CameraName + "/Hawkeye recognition", nameof(RecipeNameFilter));
}
}

View File

@@ -7,10 +7,10 @@ public static class WorkflowRecipeHelper
private const string RECIPES_DIR = "..\\Data\\Recipes";
public static List<string> ListRecipeFiles()
public static List<string> ListRecipeFiles(string nameFilter)
{
Directory.CreateDirectory(RECIPES_DIR);
var recipes = Directory.GetFiles(RECIPES_DIR, "*.hrcp");
var recipes = Directory.GetFiles(RECIPES_DIR, nameFilter+".hrcp");
return recipes.ToList();
}