1.0.4
This commit is contained in:
@@ -40,6 +40,8 @@ public abstract class BaseRecognitionControl: IRecognitionControl
|
||||
|
||||
public RecipeData CurrentRecipe => _currentRecipe;
|
||||
|
||||
public ILoadingService LoadingService => _loadingService;
|
||||
|
||||
private DateTime _startTime;
|
||||
|
||||
public void Start()
|
||||
@@ -141,7 +143,7 @@ public abstract class BaseRecognitionControl: IRecognitionControl
|
||||
|
||||
private async Task Loop(CancellationToken token)
|
||||
{
|
||||
// Start the recognition process using the Hawkeye library
|
||||
|
||||
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using CommunityToolkit.Mvvm.Input;
|
||||
using OpenCvSharp;
|
||||
using VisionBuilder.UI.Common.Commands;
|
||||
using VisionBuilder.UI.Common.Commands.Interfaces;
|
||||
using VisionBuilder.UI.Common.Services;
|
||||
using VisionBuilder.UI.Common.ViewModel.Classes;
|
||||
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
@@ -16,12 +17,14 @@ public partial class ErrorPreviewVM:ObservableObject
|
||||
private ErrorData _errorData;
|
||||
|
||||
private readonly ILearningTool _learningTool;
|
||||
private readonly IPasswordInputService _passwordInputService;
|
||||
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private string _recipeName;
|
||||
|
||||
private readonly UIConfiguration _uiConfiguration;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _learnButtonVisible;
|
||||
|
||||
@@ -37,13 +40,15 @@ public partial class ErrorPreviewVM:ObservableObject
|
||||
[ObservableProperty]
|
||||
private Mat _imageAnalysis;
|
||||
|
||||
public ErrorPreviewVM(ErrorsVM errorsVm, ErrorData errorData, string recipeName, UIConfiguration uiConfiguration, ILearningTool learningTool)
|
||||
public ErrorPreviewVM(ErrorsVM errorsVm, ErrorData errorData, string recipeName, UIConfiguration uiConfiguration, ILearningTool learningTool, IPasswordInputService passwordInputService)
|
||||
{
|
||||
_errorsVm = errorsVm;
|
||||
_errorData = errorData;
|
||||
_recipeName = recipeName;
|
||||
_uiConfiguration = uiConfiguration;
|
||||
_learningTool = learningTool;
|
||||
|
||||
_passwordInputService = passwordInputService;
|
||||
|
||||
UpdateData();
|
||||
}
|
||||
|
||||
@@ -95,6 +100,11 @@ public partial class ErrorPreviewVM:ObservableObject
|
||||
[RelayCommand(CanExecute = nameof(LearnButtonVisible))]
|
||||
public void Learn()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_uiConfiguration.AdminPassword))
|
||||
{
|
||||
var passwordOk= _passwordInputService.GetPassword()==_uiConfiguration.AdminPassword;
|
||||
if (!passwordOk) return;
|
||||
}
|
||||
_learningTool.Learn(_errorData.RecipeName, _errorData.ImageOriginal);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using VisionBuilder.UI.Common.Commands;
|
||||
using VisionBuilder.UI.Common.Commands.Interfaces;
|
||||
using VisionBuilder.UI.Common.Services;
|
||||
using VisionBuilder.UI.Common.ViewModel.Classes;
|
||||
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
||||
|
||||
@@ -11,12 +12,14 @@ public class ErrorsVM:IEventHandler<ImageProcessedEvent>, IEventHandler<SessionS
|
||||
private readonly UIConfiguration _uiConfiguration;
|
||||
private readonly IImagePreviewService _imagePreviewService;
|
||||
private readonly ILearningTool _learningTool;
|
||||
private readonly IPasswordInputService _passwordInputService;
|
||||
|
||||
public ErrorsVM(UIConfiguration uiConfiguration, IImagePreviewService imagePreviewService, ILearningTool learningTool)
|
||||
public ErrorsVM(UIConfiguration uiConfiguration, IImagePreviewService imagePreviewService, ILearningTool learningTool, IPasswordInputService passwordInputService)
|
||||
{
|
||||
_uiConfiguration = uiConfiguration;
|
||||
_imagePreviewService = imagePreviewService;
|
||||
_learningTool = learningTool;
|
||||
_passwordInputService = passwordInputService;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +29,7 @@ public class ErrorsVM:IEventHandler<ImageProcessedEvent>, IEventHandler<SessionS
|
||||
{
|
||||
if (errorData == null) return;
|
||||
|
||||
var vm = new ErrorPreviewVM(this, errorData, errorData.RecipeName, _uiConfiguration, _learningTool);
|
||||
var vm = new ErrorPreviewVM(this, errorData, errorData.RecipeName, _uiConfiguration, _learningTool, _passwordInputService);
|
||||
_imagePreviewService.ShowImagePreview(vm);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.ComponentModel;
|
||||
using VisionBuilder.UI.Common.Commands;
|
||||
using VisionBuilder.UI.Common.Commands.Interfaces;
|
||||
using VisionBuilder.UI.Common.Processing;
|
||||
using VisionBuilder.UI.Common.Services;
|
||||
using VisionBuilder.UI.Common.ViewModel;
|
||||
using VisionBuilder.UI.Common.ViewModel.Classes;
|
||||
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
||||
@@ -78,12 +79,12 @@ namespace VisionBuilder.UI.Common
|
||||
private RecipeData? _selectedRecipe;
|
||||
|
||||
|
||||
public SingleCameraVM(CameraSettings cameraSettings, UIConfiguration uiConfiguration, IRecipeSelectionDialogService recipeSelectionDialogService, IRecognitionControl recognitionControl, IImagePreviewService imagePreviewService, ILearningTool learningTool)
|
||||
public SingleCameraVM(CameraSettings cameraSettings, UIConfiguration uiConfiguration, IRecipeSelectionDialogService recipeSelectionDialogService, IRecognitionControl recognitionControl, IImagePreviewService imagePreviewService, ILearningTool learningTool, IPasswordInputService passwordInputService)
|
||||
{
|
||||
_recipeSelectionDialogService = recipeSelectionDialogService;
|
||||
|
||||
_recognitionControl = recognitionControl;
|
||||
ErrorsVm = new ErrorsVM(uiConfiguration, imagePreviewService, learningTool);
|
||||
ErrorsVm = new ErrorsVM(uiConfiguration, imagePreviewService, learningTool, passwordInputService);
|
||||
StatisticsVm = new StatisticsVM();
|
||||
PreviewVm = new PreviewVM();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user