This commit is contained in:
EugeneTes
2026-03-23 10:30:30 +01:00
parent ac0b298644
commit 34b74ecdcd
17 changed files with 42 additions and 14 deletions

View File

@@ -80,7 +80,7 @@ namespace Hawkeye.VisionBuilder.UI.Sources.Emulation
try
{
_currentFolder = imagesFolder;
var path = Path.Combine(@"..\Data\Emulation", imagesFolder);
var path = Path.Combine("..", "Data", "Emulation", imagesFolder);
_selectedFiles = Directory.GetFiles(path, "*.bmp")
.Concat(Directory.GetFiles(path, "*.png"))
.Concat(Directory.GetFiles(path, "*.jpg"))

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<PlatformTarget>x64</PlatformTarget>
<Configurations>Debug;Release;CPU</Configurations>
</PropertyGroup>

View File

@@ -19,7 +19,7 @@ namespace CandyboxPlugin.Detectors
// get this dll path
var path=Assembly.GetCallingAssembly().Location;
var dir=System.IO.Path.GetDirectoryName(path);
var modelPath = Path.Combine(dir,"models\\" + MODEL_NAME);
var modelPath = Path.Combine(dir,"models" , MODEL_NAME);
_AIsession = new InferenceSession(modelPath, opts);
_inputName = _AIsession.InputMetadata.First().Key;
_dimensions = _AIsession.InputMetadata.First().Value.Dimensions;

View File

@@ -18,7 +18,7 @@ namespace CandyboxPlugin.Detectors
// get this dll path
var path = Assembly.GetCallingAssembly().Location;
var dir = System.IO.Path.GetDirectoryName(path);
var modelPath = Path.Combine(dir, "models\\" + MODEL_NAME);
var modelPath = Path.Combine(dir, "models" , MODEL_NAME);
_AIsession = new InferenceSession(modelPath, opts);
_inputName = _AIsession.InputMetadata.First().Key;
_dimensions = _AIsession.InputMetadata.First().Value.Dimensions;

View File

@@ -47,6 +47,7 @@ public partial class MainLayout : IDisposable
};
private MudTheme _currentTheme = null!;
private bool _disposed;
protected override void OnInitialized()
{
@@ -71,6 +72,7 @@ public partial class MainLayout : IDisposable
private async void OnPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (_disposed) return;
if (e.PropertyName == nameof(MainWindowVM.TestMode))
{
_testMode = MainWindowVm.TestMode;
@@ -98,6 +100,7 @@ public partial class MainLayout : IDisposable
public void Dispose()
{
_disposed = true;
MainWindowVm.PropertyChanged -= OnPropertyChanged;
}
}

View File

@@ -26,7 +26,7 @@ builder.Services.AddMudServices();
CommandLineParser commandLineParser = new CommandLineParser(args);
// Setup settings
InspectronSettings settings = new InspectronSettings("..\\Data\\Config");
InspectronSettings settings = new InspectronSettings(Path.Combine("..", "Data", "Config"));
var mainKernel = VisionBuilder.UI.Common.VisionBuilder.CreateMainKernel(settings);

View File

@@ -16,6 +16,7 @@
<ItemGroup>
<PackageReference Include="MudBlazor" Version="8.0.0" />
<PackageReference Include="Ninject.Extensions.ChildKernel" Version="3.3.0" />
<PackageReference Include="OpenCvSharp4.runtime.linux-arm" Version="4.13.0.20260318" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.6.0.20220608" />
</ItemGroup>

View File

@@ -12,6 +12,7 @@ public partial class ErrorPreview : ComponentBase, IDisposable
private List<ErrorData> _errors = new();
private ErrorsVM? _subscribedVm;
private bool _disposed;
protected override void OnParametersSet()
{
@@ -41,6 +42,7 @@ public partial class ErrorPreview : ComponentBase, IDisposable
private async void OnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (_disposed) return;
if (ViewModel != null)
_errors = new List<ErrorData>(ViewModel.Errors);
await InvokeAsync(StateHasChanged);
@@ -54,6 +56,7 @@ public partial class ErrorPreview : ComponentBase, IDisposable
public void Dispose()
{
_disposed = true;
Unsubscribe();
}
}

View File

@@ -15,6 +15,7 @@ public partial class PreviewWindow : ComponentBase, IDisposable
private DateTime _lastRenderTime = DateTime.MinValue;
private Timer? _pendingTimer;
private PreviewVM? _subscribedVm;
private bool _disposed;
protected override void OnParametersSet()
{
@@ -69,6 +70,8 @@ public partial class PreviewWindow : ComponentBase, IDisposable
private async Task RenderCurrentFrame()
{
if (_disposed) return;
_lastRenderTime = DateTime.UtcNow;
var mat = ViewModel?.ImagePreview;
@@ -88,6 +91,7 @@ public partial class PreviewWindow : ComponentBase, IDisposable
public void Dispose()
{
_disposed = true;
_pendingTimer?.Dispose();
Unsubscribe();
}

View File

@@ -18,6 +18,7 @@ public partial class SingleCameraControl : ComponentBase, IDisposable
private bool _canHotReload;
private bool _showPauseButton;
private SingleCameraVM? _subscribedVm;
private bool _disposed;
protected override void OnParametersSet()
{
@@ -61,6 +62,7 @@ public partial class SingleCameraControl : ComponentBase, IDisposable
private async void OnPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (_disposed) return;
UpdateState();
await InvokeAsync(StateHasChanged);
}
@@ -103,6 +105,7 @@ public partial class SingleCameraControl : ComponentBase, IDisposable
public void Dispose()
{
_disposed = true;
Unsubscribe();
}
}

View File

@@ -17,6 +17,7 @@ public partial class Stats : ComponentBase, IDisposable
private string _errorRate = "";
private string _statisticsDetails = "";
private StatisticsVM? _subscribedVm;
private bool _disposed;
protected override void OnParametersSet()
{
@@ -43,6 +44,8 @@ public partial class Stats : ComponentBase, IDisposable
private async void OnPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (_disposed) return;
_sessionStarted = ViewModel?.SessionStarted ?? "";
_recipeName = ViewModel?.RecipeName ?? "";
_processingTime = ViewModel?.ProcessingTime ?? "";
@@ -57,6 +60,7 @@ public partial class Stats : ComponentBase, IDisposable
public void Dispose()
{
_disposed = true;
Unsubscribe();
}
}

View File

@@ -48,14 +48,24 @@
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
[Parameter] public ErrorPreviewVM? ViewModel { get; set; }
private ErrorPreviewVM? _subscribedVm;
private bool _disposed;
protected override void OnParametersSet()
{
if (ViewModel != null)
ViewModel.PropertyChanged += OnPropertyChanged;
if (_subscribedVm != ViewModel)
{
if (_subscribedVm != null)
_subscribedVm.PropertyChanged -= OnPropertyChanged;
_subscribedVm = ViewModel;
if (ViewModel != null)
ViewModel.PropertyChanged += OnPropertyChanged;
}
}
private async void OnPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (_disposed) return;
await InvokeAsync(StateHasChanged);
}
@@ -72,7 +82,8 @@
public void Dispose()
{
if (ViewModel != null)
ViewModel.PropertyChanged -= OnPropertyChanged;
_disposed = true;
if (_subscribedVm != null)
_subscribedVm.PropertyChanged -= OnPropertyChanged;
}
}

View File

@@ -6,7 +6,7 @@ public static class WorkflowRecipeHelper
{
private const string RECIPES_DIR = "..\\Data\\Recipes";
private static string RECIPES_DIR => Path.Combine("..", "Data", "Recipes");
public static List<string> ListRecipeFiles(string nameFilter)
{
Directory.CreateDirectory(RECIPES_DIR);

View File

@@ -25,7 +25,7 @@ Specifies directory, in which MaxBad and MaxGood are applied.
"+ PathSettingsUtils.INSTUCTIONS
)]
[SettingPreview(typeof(VisionBuilderRingbufferSettings), nameof(ImagesPathTemplatePreview))]
public string Root { get; set; } = @"..\Data\Ringbuffer\$SS_MONTH_NAME $SS_YEAR";
public string Root { get; set; } = Path.Combine("..", "Data", "Ringbuffer", "$SS_MONTH_NAME $SS_YEAR");

View File

@@ -20,7 +20,7 @@ Specifies directory, in which MaxBad and MaxGood are applied.
"+PathSettingsUtils.INSTUCTIONS
)]
[SettingPreview(typeof(VisionBuilderStatisticsSettings), nameof(PathTemplatePreview))]
public string PathTemplate { get; set; }= @$"..\Data\Statistics\$SS_MONTH_NUM $SS_YEAR\$RECIPE_NAME\";
public string PathTemplate { get; set; }= Path.Combine("..", "Data", "Statistics", "$SS_MONTH_NUM $SS_YEAR", "$RECIPE_NAME");
public string StartDateColumnName { get; set; } = "Start Date";
public string StartTimeColumnName { get; set; } = "Start time";

View File

@@ -29,7 +29,7 @@ internal static class Program
MaterialSkin.MaterialSkinManager.ConfigureForInspectron();
CommandLineParser commandLineParser = new CommandLineParser(args);
InspectronSettings settings = new InspectronSettings("..\\Data\\Config");
InspectronSettings settings = new InspectronSettings(Path.Combine("..", "Data", "Config"));
var mainKernel = VisionBuilder.UI.Common.VisionBuilder.CreateMainKernel(settings);
var profile = commandLineParser.GetStringArgument("profile", 'p');

View File

@@ -32,7 +32,7 @@ namespace Inspectron.Camera.Emulation
try
{
_currentFolder = imagesFolder;
var path = Path.Combine(@"..\Data\Emulation", imagesFolder);
var path = Path.Combine("..","Data","Emulation", imagesFolder);
_selectedFiles = Directory.GetFiles(path, "*.bmp")
.Concat(Directory.GetFiles(path, "*.png"))
.Concat(Directory.GetFiles(path, "*.jpg"))