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 AiPromptbausteinSelectionComplexViewModel : DialogViewModel { private AiPromptbausteinFolderVM _SelectedFolder; public AiPromptbausteinSelectionComplexViewModel() { SendCommand = new DelegateCommand(Send, CanSend, true); if (BeWoApp.IsInDesignMode) { Folders = new AiPromptbausteinFolderListVM(); } } public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this() { AiActionType = aiActionType; } public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel) : this(aiActionType) { Folders = viewModel; } public event EventHandler PromptAccepted; public AiActionType AiActionType { get; set; } public AiPromptbausteinFolderVM SelectedFolder { get => _SelectedFolder; set { _SelectedFolder = value; FirePropertyChanged(nameof(SelectedFolder)); } } public AiPromptbausteinPromptVM SelectedPrompt { get; set; } public AiPromptbausteinFolderListVM Folders { get; private set; } public ICommand SendCommand { get; set; } public void Send() { CloseDialogCommand.Execute(null); PromptAccepted?.Invoke(this, SelectedPrompt); } public bool CanSend() { return SelectedPrompt is object; } public void ReloadVMList() { VMFactory.CreateAiPromptbausteinFolderListVMAsync(AiActionType, UpdateVMList); } private void UpdateVMList(AiPromptbausteinFolderListVM new_list) { Folders = new_list; FirePropertyChanged(nameof(Folders)); } } }