Steps werden geupdatet beim Speichern
This commit is contained in:
@@ -117,7 +117,7 @@ namespace BeWo.Services
|
||||
Height = 400,
|
||||
Width = 600
|
||||
};
|
||||
Show("KI Promptbaustein Prompt", control, viewModel, options);
|
||||
Show("KI Promptbaustein Routine", control, viewModel, options);
|
||||
}
|
||||
public void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel)
|
||||
{
|
||||
|
||||
@@ -50,5 +50,12 @@ namespace BeWo.ViewModel
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
|
||||
public override void UpdateByDataContract(AiPromptbausteinRoutineStepDC pDataContract)
|
||||
{
|
||||
Position = pDataContract.Position;
|
||||
PromptReference = pDataContract.PromptReference;
|
||||
ReferenceVersion = pDataContract.ReferenceVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,10 +131,7 @@ namespace BeWo.ViewModel
|
||||
IsPublic = pDataContract.IsPublic;
|
||||
IsFavorite = pDataContract.IsFavorite;
|
||||
|
||||
var steps = new AiPromptbausteinRoutineStepListVM(pDataContract.Steps);
|
||||
|
||||
Steps.VMList.Clear();
|
||||
Steps.VMList.AddRange(steps.VMList);
|
||||
Steps.UpdateByDataContracts(pDataContract.Steps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,5 +291,10 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void UpdateByDataContracts(List<DCType> pDataContracts)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace BeWo.ViewModel.ListViewModel
|
||||
{
|
||||
@@ -13,5 +14,41 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateByDataContracts(List<AiPromptbausteinRoutineStepDC> pDataContracts)
|
||||
{
|
||||
var count_a = Count;
|
||||
var count_b = pDataContracts.Count;
|
||||
|
||||
// 1-k updaten
|
||||
var count_toupdate = Math.Min(count_a, count_b);
|
||||
for ( var i = 0; i < count_toupdate; i++)
|
||||
{
|
||||
var a = VMList[i];
|
||||
var b = pDataContracts[i];
|
||||
|
||||
a.UpdateByDataContract(b);
|
||||
}
|
||||
|
||||
if (count_a == count_b)
|
||||
return;
|
||||
|
||||
if(count_a > count_b)
|
||||
{
|
||||
for (var i = count_a - 1; i > count_toupdate - 1; i--)
|
||||
{
|
||||
VMList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = count_toupdate; i < count_b; i++)
|
||||
{
|
||||
var dc = pDataContracts[i];
|
||||
var vm = new AiPromptbausteinRoutineStepVM(dc);
|
||||
VMList.Add(vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user