Yess
Some checks failed
Mirror to Gitea / git-sync (push) Has been cancelled

This commit is contained in:
2026-03-28 00:26:55 +02:00
parent ea2d84f5cc
commit ae0994409a
15 changed files with 660 additions and 94 deletions

View File

@@ -1,20 +1,30 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using VisionAsist.Models;
using VisionAsist.Views;
using Avalonia.Threading;
namespace VisionAsist.ViewModels;
public partial class MainWindowViewModel : ViewModelBase
{
public MainWindowViewModel()
{
Selector.OnLogUpdate += text =>
{
Dispatcher.UIThread.Post(() =>
{
CommandLog += text;
});
};
}
[RelayCommand]
private void Settingse()
{
new Settings
{
DataContext = new SettingsViewModel()
}.Show();
new Settings { DataContext = new SettingsViewModel() }.Show();
}
[ObservableProperty]
@@ -23,19 +33,23 @@ public partial class MainWindowViewModel : ViewModelBase
[ObservableProperty]
private string commandText = string.Empty;
[ObservableProperty]
private bool isGenerating = false;
[RelayCommand]
private void Send()
private async Task Send()
{
if (!string.IsNullOrWhiteSpace(CommandText))
if (!string.IsNullOrWhiteSpace(CommandText) && !IsGenerating)
{
// Отображаем введенную команду в логе
CommandLog = CommandText;
// Отправляем в селектор
Selector.selector(CommandText);
// Очищаем поле ввода
string input = CommandText;
CommandText = string.Empty;
IsGenerating = true;
// Запускаем логику в фоновом потоке, чтобы UI не зависал
await Task.Run(async () => {
await Selector.selector(input);
IsGenerating = false;
});
}
}
}

View File

@@ -23,7 +23,7 @@ public class SettingsViewModel : ViewModelBase
public SettingsViewModel()
{
foreach (var module in Core.modulelist)
foreach (var module in Core.ModuleList)
{
AddModule(module.Name);
@@ -43,7 +43,7 @@ public class SettingsViewModel : ViewModelBase
private void OpenSettings(string moduleName)
{
var module = Core.modulelist.FirstOrDefault(m => m.Name == moduleName);
var module = Core.ModuleList.FirstOrDefault(m => m.Name == moduleName);
if (module != null)
{
module.Module.Settings(new object[] { this });