--- Wer reitet so spät durch Nacht und Wind? Es ist der Vater mit seinem Kind; Er hat den Knaben wohn in dem Arm, Er faβt ihn sicher, er hält ihn warm.
50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using BeWo.ViewModel.ListViewModel;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.ViewModel.View.Administration
|
|
{
|
|
public class AiPromptbausteinRoutineViewModel : AcceptCancelDialogViewModel
|
|
{
|
|
private readonly bool _IsNew;
|
|
public AiPromptbausteinRoutineStepVM _SelectedStep;
|
|
|
|
public AiPromptbausteinRoutineViewModel(AiPromptbausteinRoutineVM viewModel, AiPromptbausteinFolderListVM folders, bool isNew) : base()
|
|
{
|
|
ViewModel = viewModel;
|
|
FolderListVM = folders;
|
|
_IsNew = isNew;
|
|
|
|
ViewModel.PropertyChanged += (s, e) =>
|
|
{
|
|
AcceptCommand.RaiseCanExecuteChanged();
|
|
};
|
|
|
|
ViewModel.Steps.VMList.ListChanged += (s, e) =>
|
|
{
|
|
AcceptCommand.RaiseCanExecuteChanged();
|
|
};
|
|
}
|
|
|
|
|
|
public AiPromptbausteinFolderListVM FolderListVM { get; set; }
|
|
public AiPromptbausteinRoutineVM ViewModel { get; private set; }
|
|
|
|
public AiPromptbausteinRoutineStepVM SelectedStep
|
|
{
|
|
get => _SelectedStep;
|
|
set => SetProperty(ref _SelectedStep, value, nameof(SelectedStep));
|
|
}
|
|
|
|
public string AcceptButtonText => _IsNew ? "Hinzufügen" : "Speichern";
|
|
|
|
protected override bool canAccept()
|
|
{
|
|
return (_IsNew || ViewModel.IsDirty) && !string.IsNullOrWhiteSpace(ViewModel.Title) && (ViewModel.Steps?.VMList.Any() ?? false);
|
|
}
|
|
}
|
|
}
|