1.0.4
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user