Files
BeWoPlaner/BeWo/ViewModel/ListViewModel/AiPromptbausteinTreeListVM.cs

52 lines
1.1 KiB
C#
Raw Normal View History

2025-11-03 10:41:52 +01:00
using System.Collections.Generic;
using System.Linq;
using BS.Shared.DataContracts.Feature.AI;
namespace BeWo.ViewModel.ListViewModel
{
public class AiPromptbausteinTreeListVM : AbstractDCListMapperVM<AiPromptbausteinTreeDC, AiPromptbausteinTreeVM>
{
2025-11-03 10:41:52 +01:00
public AiPromptbausteinTreeListVM() : this(null)
{
2025-11-24 12:20:26 +01:00
if (BeWoApp.IsInDesignMode)
{
2025-11-03 10:41:52 +01:00
InitDesigner();
2025-11-24 12:20:26 +01:00
}
2025-11-03 10:41:52 +01:00
}
public AiPromptbausteinTreeListVM(IEnumerable<AiPromptbausteinTreeDC> pDataContracts = null, AiPromptbausteinTreeVM aiPromptbausteinTreeVM = null) : base(pDataContracts)
{
2025-11-03 10:41:52 +01:00
foreach (var vm in VMList)
{
vm.Parent = aiPromptbausteinTreeVM;
}
}
public bool ContainsDirtyNode()
{
if (IsDirty)
return true;
foreach (var vm in VMList)
{
if (vm.Children is object && vm.Children.ContainsDirtyNode())
return true;
}
return false;
}
2025-11-03 10:41:52 +01:00
#region Designer
private void InitDesigner()
{
2025-12-12 14:57:26 +01:00
var prompts = PredefinedAiPromptbausteine.GenerateDesignerInstance();
2025-11-03 10:41:52 +01:00
2025-12-12 14:57:26 +01:00
foreach (var vm in prompts)
{
VMList.Add(new AiPromptbausteinTreeVM(vm));
}
2025-11-03 10:41:52 +01:00
}
#endregion
}
}