Folder CanAdd CanEdit Logik

This commit is contained in:
2025-12-30 14:43:25 +01:00
parent 379f954af1
commit 943cd82c8b
5 changed files with 54 additions and 18 deletions

View File

@@ -5,6 +5,7 @@ using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Extensions.CustomInterfaces;
using DevExpress.Mvvm;
using DevExpress.Xpf.Layout.Core;
using System;
using System.Collections.Generic;
@@ -12,7 +13,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using DelegateCommand = DevExpress.Mvvm.DelegateCommand;
namespace BeWo.ViewModel.View.Administration
{
@@ -27,17 +27,17 @@ namespace BeWo.ViewModel.View.Administration
public AiPromptbausteinPromptVM SelectedPrompt { get; set; }
public AiPromptbausteinFolderVM CopiedFolder { get; set; }
public ICommand OpenAddFolderDialogCommand { get; private set; }
public ICommand OpenEditFolderDialogCommand { get; private set; }
public ICommand CopyFolderCommand { get; private set; }
public ICommand PasteFolderCommand { get; private set; }
public ICommand DeleteFolderCommand { get; private set; }
public DelegateCommand OpenAddFolderDialogCommand { get; private set; }
public DelegateCommand OpenEditFolderDialogCommand { get; private set; }
public DelegateCommand CopyFolderCommand { get; private set; }
public DelegateCommand PasteFolderCommand { get; private set; }
public DelegateCommand DeleteFolderCommand { get; private set; }
public ICommand OpenAddPromptDialogCommand { get; private set; }
public ICommand OpenEditPromptDialogCommand { get; private set; }
public ICommand CopyPromptCommand { get; private set; }
public ICommand PastePromptCommand { get; private set; }
public ICommand DeletePromptCommand { get; private set; }
public DelegateCommand OpenAddPromptDialogCommand { get; private set; }
public DelegateCommand OpenEditPromptDialogCommand { get; private set; }
public DelegateCommand CopyPromptCommand { get; private set; }
public DelegateCommand PastePromptCommand { get; private set; }
public DelegateCommand DeletePromptCommand { get; private set; }
public AiPromptbausteinFolderVM SelectedFolder
{
@@ -75,6 +75,17 @@ namespace BeWo.ViewModel.View.Administration
}
}
public bool HasCopiedFolder => CopiedFolder is object;
public void UpdateFolderCommands()
{
OpenAddFolderDialogCommand.RaiseCanExecuteChanged();
OpenEditFolderDialogCommand.RaiseCanExecuteChanged();
CopyFolderCommand.RaiseCanExecuteChanged();
PasteFolderCommand.RaiseCanExecuteChanged();
DeleteFolderCommand.RaiseCanExecuteChanged();
}
public void SaveVMList()
{
@@ -104,7 +115,8 @@ namespace BeWo.ViewModel.View.Administration
var vm = new AiPromptbausteinFolderViewModel(new_vm, true);
vm.Accept_Button_Clicked += (s, e) => {
vm.Accept_Button_Clicked += (s, e) =>
{
sel_folder.SubFolders.VMList.Add(new_vm);
sel_folder.IsExpanded = true;
};
@@ -142,24 +154,26 @@ namespace BeWo.ViewModel.View.Administration
bool canOpenAddFolderDialog()
{
return true;
return SelectedFolder.CanAdd;
}
bool canOpenEditFolderDialog()
{
return true;
return SelectedFolder.CanEdit;
}
bool canCopyFolder()
{
return false;
//return SelectedFolder.CanEdit;
}
bool canPasteFolder()
{
return false;
//return HasCopiedFolder && SelectedFolder.CanAdd;
}
bool canDeleteFolder()
{
return false;
return SelectedFolder.CanEdit;
}
}
}