Files
BeWoPlaner/BeWo/ViewModel/View/AI/AiPromptbausteinSelectionViewModel.cs
Rene Evertz 5a34c0dc04 Prompt Result Fenster
+ Info nur bei Selected
+ Welche DCs sollen gespeichert werden
2026-01-09 14:47:01 +01:00

72 lines
1.7 KiB
C#

using BeWo.ServiceProxy;
using BeWo.Services;
using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.Extensions.CustomInterfaces;
using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
namespace BeWo.ViewModel.View.AI
{
public class AiPromptbausteinSelectionViewModel : DialogViewModel
{
public AiPromptbausteinSelectionViewModel()
{
SendCommand = new DelegateCommand(Send, CanSend, true);
if (BeWoApp.IsInDesignMode)
{
ListVM = new AiPromptbausteinTreeListVM();
}
}
public AiPromptbausteinSelectionViewModel(AiActionType aiActionType) : this()
{
AiActionType = aiActionType;
}
public AiPromptbausteinSelectionViewModel(AiActionType aiActionType, AiPromptbausteinTreeListVM viewModel) : this(aiActionType)
{
ListVM = viewModel;
}
public event EventHandler<AiPromptbausteinTreeVM> PromptAccepted;
public AiActionType AiActionType { get; set; }
public AiPromptbausteinTreeVM SelectedNode { get; set; }
public AiPromptbausteinTreeListVM ListVM { get; private set; }
public ICommand SendCommand { get; set; }
public void Send()
{
CloseDialogCommand.Execute(null);
PromptAccepted?.Invoke(this, SelectedNode);
}
public bool CanSend()
{
return SelectedNode is object && SelectedNode.IsExecutable();
}
public void ReloadVMList()
{
VMFactory.CreateAiPromptbausteinSubTreeListAsync(AiActionType, UpdateVMList);
}
private void UpdateVMList(AiPromptbausteinTreeListVM new_list)
{
ListVM = new_list;
FirePropertyChanged(nameof(ListVM));
}
}
}