web UI
This commit is contained in:
@@ -43,7 +43,7 @@ public class PluginLoader:IVisionBuilderModule
|
||||
if (!File.Exists(enabledPluginsPath))
|
||||
{
|
||||
Log.Warning("Enabled plugins file not found: {EnabledPluginsPath}. All discovered plugins will be disabled by default.", enabledPluginsPath);
|
||||
File.WriteAllText(enabledPluginsPath, "");
|
||||
File.WriteAllText(enabledPluginsPath, "");
|
||||
}
|
||||
|
||||
List<string> enabledPlugins = File.ReadAllLines(enabledPluginsPath).ToList();
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
public interface IPasswordInputService
|
||||
{
|
||||
string GetPassword();
|
||||
Task<string?> GetPasswordAsync();
|
||||
}
|
||||
@@ -117,11 +117,11 @@ public partial class ErrorPreviewVM:ObservableObject
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(LearnButtonVisible))]
|
||||
public void Learn()
|
||||
public async Task Learn()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_uiConfiguration.AdminPassword))
|
||||
{
|
||||
var passwordOk= _passwordInputService.GetPassword()==_uiConfiguration.AdminPassword;
|
||||
var passwordOk = await _passwordInputService.GetPasswordAsync() == _uiConfiguration.AdminPassword;
|
||||
if (!passwordOk) return;
|
||||
}
|
||||
_learningTool.Learn(_errorData.RecipeName, _errorData.ImageOriginal);
|
||||
|
||||
@@ -28,13 +28,13 @@ public class ErrorsVM:IEventHandler<ImageProcessedEvent>, IEventHandler<SessionS
|
||||
|
||||
public ObservableCollection<ErrorData> Errors { get; set; } = new ObservableCollection<ErrorData>();
|
||||
|
||||
public void ShowImage(ErrorData errorData)
|
||||
public async Task ShowImage(ErrorData errorData)
|
||||
{
|
||||
if (errorData == null) return;
|
||||
|
||||
|
||||
var vm = new ErrorPreviewVM(this, errorData, errorData.RecipeName, _uiConfiguration, _learningTool, _passwordInputService);
|
||||
_imagePreviewService.ShowImagePreview(vm);
|
||||
|
||||
await _imagePreviewService.ShowImagePreviewAsync(vm);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
||||
|
||||
public interface IImagePreviewService
|
||||
{
|
||||
void ShowImagePreview(ErrorPreviewVM errorPreviewVm);
|
||||
Task ShowImagePreviewAsync(ErrorPreviewVM errorPreviewVm);
|
||||
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
public interface IRecipeSelectionDialogService
|
||||
{
|
||||
bool SelectRecipe(RecipeSelectionVM recipeSelectionVm);
|
||||
Task<bool> SelectRecipeAsync(RecipeSelectionVM recipeSelectionVm);
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
public interface ISettingsService
|
||||
{
|
||||
void ShowSettingsDialog();
|
||||
Task ShowSettingsDialogAsync();
|
||||
}
|
||||
@@ -27,9 +27,9 @@ public partial class MainWindowVM:ObservableObject
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
public void Settings()
|
||||
public async Task Settings()
|
||||
{
|
||||
_settingsService.ShowSettingsDialog();
|
||||
await _settingsService.ShowSettingsDialogAsync();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
||||
@@ -118,10 +118,10 @@ namespace VisionBuilder.UI.Common
|
||||
|
||||
|
||||
[RelayCommand(CanExecute = nameof(IsNotRunning))]
|
||||
public void SelectRecipe()
|
||||
public async Task SelectRecipe()
|
||||
{
|
||||
var vm = GetRecipeSelectionVm();
|
||||
if (!_recipeSelectionDialogService.SelectRecipe(vm))return;
|
||||
if (!await _recipeSelectionDialogService.SelectRecipeAsync(vm))return;
|
||||
ProcessRecipeSelectionVm(vm);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user