History Feature soweit abgeschlosse, restliche undo redo actions implementiert
This commit is contained in:
@@ -1055,7 +1055,7 @@
|
|||||||
<Compile Include="View\Detail\DebugMessageLogView.xaml.cs">
|
<Compile Include="View\Detail\DebugMessageLogView.xaml.cs">
|
||||||
<DependentUpon>DebugMessageLogView.xaml</DependentUpon>
|
<DependentUpon>DebugMessageLogView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="View\Detail\MassnahmenActionParameters.cs" />
|
<Compile Include="View\Detail\MassnahmenHistoryRecord.cs" />
|
||||||
<Compile Include="View\Detail\MassnahmenHistory.cs" />
|
<Compile Include="View\Detail\MassnahmenHistory.cs" />
|
||||||
<Compile Include="View\Detail\MassnahmenTreeTrimmer.cs" />
|
<Compile Include="View\Detail\MassnahmenTreeTrimmer.cs" />
|
||||||
<Compile Include="View\Detail\Zeiterfassung\ServiceRecordCreationView.xaml.cs">
|
<Compile Include="View\Detail\Zeiterfassung\ServiceRecordCreationView.xaml.cs">
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
using BeWo.Core;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BeWo.View.Detail
|
|
||||||
{
|
|
||||||
public abstract class MassnahmenHistoryRecord
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryRecordOrigin : MassnahmenHistoryRecord
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryRecordAdd : MassnahmenHistoryRecord
|
|
||||||
{
|
|
||||||
public SupportConceptGoalTreeItem NewTreeItem { get; set; }
|
|
||||||
public SupportConceptGoalTreeItem Parent { get; set; }
|
|
||||||
|
|
||||||
public MassnahmenHistoryRecordAdd(SupportConceptGoalTreeItem newitem, SupportConceptGoalTreeItem parent)
|
|
||||||
{
|
|
||||||
NewTreeItem = newitem;
|
|
||||||
Parent = parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryRecordImport : MassnahmenHistoryRecord
|
|
||||||
{
|
|
||||||
public List<MassnahmenHistoryParameter1> Parameters { get; set; }
|
|
||||||
|
|
||||||
public MassnahmenHistoryRecordImport(List<MassnahmenHistoryParameter1> list)
|
|
||||||
{
|
|
||||||
Parameters = list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryRecordDelete : MassnahmenHistoryRecord
|
|
||||||
{
|
|
||||||
public List<MassnahmenHistoryParameter2> Parameters { get; set; }
|
|
||||||
|
|
||||||
public MassnahmenHistoryRecordDelete(List<MassnahmenHistoryParameter2> list)
|
|
||||||
{
|
|
||||||
Parameters = list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryRecordMove : MassnahmenHistoryRecord
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryRecordCopy : MassnahmenHistoryRecord
|
|
||||||
{
|
|
||||||
public List<MassnahmenHistoryParameter1> Parameters { get; set; }
|
|
||||||
|
|
||||||
public MassnahmenHistoryRecordCopy(List<MassnahmenHistoryParameter1> list)
|
|
||||||
{
|
|
||||||
Parameters = list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class MassnahmenHistoryParameter
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryParameter1 : MassnahmenHistoryParameter
|
|
||||||
{
|
|
||||||
public SupportConceptGoalTreeItem NewTreeItem { get; set; }
|
|
||||||
public SupportConceptGoalTreeItem Parent { get; set; }
|
|
||||||
|
|
||||||
public MassnahmenHistoryParameter1(SupportConceptGoalTreeItem newitem, SupportConceptGoalTreeItem parent)
|
|
||||||
{
|
|
||||||
NewTreeItem = newitem;
|
|
||||||
Parent = parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MassnahmenHistoryParameter2 : MassnahmenHistoryParameter
|
|
||||||
{
|
|
||||||
public SupportConceptGoalTreeItem Current { get; set; }
|
|
||||||
public SupportConceptGoalTreeItem Parent { get; set; }
|
|
||||||
|
|
||||||
public MassnahmenHistoryParameter2(SupportConceptGoalTreeItem current, SupportConceptGoalTreeItem parent)
|
|
||||||
{
|
|
||||||
Current = current;
|
|
||||||
Parent = parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -59,9 +59,7 @@ namespace BeWo.View.Detail
|
|||||||
public LinkedListNode<MassnahmenHistoryRecord> LastChange { get; set; }
|
public LinkedListNode<MassnahmenHistoryRecord> LastChange { get; set; }
|
||||||
|
|
||||||
public MassnahmenTreeTrimmer TreeTrimmer { get; set; }
|
public MassnahmenTreeTrimmer TreeTrimmer { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MassnahmenHistory(MassnahmenTreeTrimmer trimmer, Action refresh, Action button)
|
public MassnahmenHistory(MassnahmenTreeTrimmer trimmer, Action refresh, Action button)
|
||||||
{
|
{
|
||||||
Origin = new MassnahmenHistoryRecordOrigin();
|
Origin = new MassnahmenHistoryRecordOrigin();
|
||||||
@@ -77,14 +75,21 @@ namespace BeWo.View.Detail
|
|||||||
|
|
||||||
public bool GotPrevAction => LastChange is object && LastChange.Value != Origin;
|
public bool GotPrevAction => LastChange is object && LastChange.Value != Origin;
|
||||||
public bool GotNextAction => LastChange is object && LastChange.Next is object;
|
public bool GotNextAction => LastChange is object && LastChange.Next is object;
|
||||||
|
public bool GotChanges => LastChange is object && (GotNextAction || GotPrevAction);
|
||||||
|
|
||||||
public void RecordAction(MassnahmenHistoryRecord val)
|
public void RecordAdd(MassnahmenHistoryNodeParameter param) => RecordAction(new MassnahmenHistoryRecordAdd(param));
|
||||||
|
public void RecordMove(MassnahmenHistoryRecordMove move) => RecordAction(move);
|
||||||
|
public void RecordImport(List<MassnahmenHistoryNodeParameter> param) => RecordAction(new MassnahmenHistoryRecordImport(param));
|
||||||
|
public void RecordDelete(MassnahmenHistoryRecordDelete del) => RecordAction(del);
|
||||||
|
public void RecordCopy(MassnahmenHistoryNodeParameter root, List<MassnahmenHistoryNodeParameter> param) => RecordAction(new MassnahmenHistoryRecordCopy(root, param));
|
||||||
|
|
||||||
|
private void RecordAction(MassnahmenHistoryRecord val)
|
||||||
{
|
{
|
||||||
while(LastChange != History.Last)
|
while (LastChange != History.Last)
|
||||||
{
|
{
|
||||||
History.RemoveLast();
|
History.RemoveLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
History.AddLast(val);
|
History.AddLast(val);
|
||||||
|
|
||||||
LastChange = History.Last;
|
LastChange = History.Last;
|
||||||
@@ -115,7 +120,6 @@ namespace BeWo.View.Detail
|
|||||||
RefreshButton();
|
RefreshButton();
|
||||||
RefreshTree();
|
RefreshTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RedoNextAction()
|
public void RedoNextAction()
|
||||||
{
|
{
|
||||||
var action = LastChange.Next.Value;
|
var action = LastChange.Next.Value;
|
||||||
|
|||||||
104
BeWo/View/Detail/MassnahmenHistoryRecord.cs
Normal file
104
BeWo/View/Detail/MassnahmenHistoryRecord.cs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
using BeWo.Core;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BeWo.View.Detail
|
||||||
|
{
|
||||||
|
public abstract class MassnahmenHistoryRecord
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MassnahmenHistoryRecordOrigin : MassnahmenHistoryRecord
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MassnahmenHistoryRecordAdd : MassnahmenHistoryRecord
|
||||||
|
{
|
||||||
|
public MassnahmenHistoryNodeParameter Parameter { get; set; }
|
||||||
|
|
||||||
|
public MassnahmenHistoryRecordAdd(SupportConceptGoalTreeItem newitem, SupportConceptGoalTreeItem parent)
|
||||||
|
{
|
||||||
|
Parameter = new MassnahmenHistoryNodeParameter(newitem, parent);
|
||||||
|
}
|
||||||
|
public MassnahmenHistoryRecordAdd(MassnahmenHistoryNodeParameter param)
|
||||||
|
{
|
||||||
|
Parameter = param;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MassnahmenHistoryRecordImport : MassnahmenHistoryRecord
|
||||||
|
{
|
||||||
|
public List<MassnahmenHistoryNodeParameter> Parameters { get; set; }
|
||||||
|
public List<MassnahmenHistoryNodeParameter> ParametersReversed { get; set; }
|
||||||
|
|
||||||
|
public MassnahmenHistoryRecordImport(List<MassnahmenHistoryNodeParameter> list)
|
||||||
|
{
|
||||||
|
Parameters = list;
|
||||||
|
ParametersReversed = new Stack<MassnahmenHistoryNodeParameter>(list).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MassnahmenHistoryRecordDelete : MassnahmenHistoryRecord
|
||||||
|
{
|
||||||
|
public MassnahmenHistoryNodeParameter ExNode { get; set; }
|
||||||
|
public List<MassnahmenHistoryNodeParameter> Parameters { get; set; }
|
||||||
|
|
||||||
|
public MassnahmenHistoryRecordDelete(MassnahmenHistoryNodeParameter exnode, List<MassnahmenHistoryNodeParameter> list)
|
||||||
|
{
|
||||||
|
Parameters = list;
|
||||||
|
ExNode = exnode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MassnahmenHistoryRecordMove : MassnahmenHistoryRecord
|
||||||
|
{
|
||||||
|
public SupportConceptGoalTreeItem Child { get; set; }
|
||||||
|
public SupportConceptGoalTreeItem ExParent { get; set; }
|
||||||
|
public SupportConceptGoalTreeItem Parent { get; set; }
|
||||||
|
|
||||||
|
public MassnahmenHistoryRecordMove(SupportConceptGoalTreeItem child, SupportConceptGoalTreeItem exparent, SupportConceptGoalTreeItem parent)
|
||||||
|
{
|
||||||
|
Child = child;
|
||||||
|
ExParent = exparent;
|
||||||
|
Parent = parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MassnahmenHistoryRecordCopy : MassnahmenHistoryRecord
|
||||||
|
{
|
||||||
|
public MassnahmenHistoryNodeParameter CurrentNode { get; set; }
|
||||||
|
public List<MassnahmenHistoryNodeParameter> Parameters { get; set; }
|
||||||
|
|
||||||
|
public MassnahmenHistoryRecordCopy(MassnahmenHistoryNodeParameter root, List<MassnahmenHistoryNodeParameter> list)
|
||||||
|
{
|
||||||
|
Parameters = list;
|
||||||
|
CurrentNode = root;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MassnahmenHistoryParameter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MassnahmenHistoryNodeParameter : MassnahmenHistoryParameter
|
||||||
|
{
|
||||||
|
public SupportConceptGoalTreeItem Current { get; set; }
|
||||||
|
public SupportConceptGoalTreeItem Parent { get; set; }
|
||||||
|
|
||||||
|
public MassnahmenHistoryNodeParameter(SupportConceptGoalTreeItem newitem, SupportConceptGoalTreeItem parent)
|
||||||
|
{
|
||||||
|
Current = newitem;
|
||||||
|
Parent = parent;
|
||||||
|
}
|
||||||
|
public MassnahmenHistoryNodeParameter(SupportConceptGoalTreeItem newitem)
|
||||||
|
{
|
||||||
|
Current = newitem;
|
||||||
|
Parent = newitem.ParentGoal as SupportConceptGoalTreeItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using BeWo.Core;
|
using BeWo.Core;
|
||||||
using BeWo.ViewModel.ListViewModel;
|
using BeWo.ViewModel.ListViewModel;
|
||||||
|
using BS.Shared;
|
||||||
using BS.Shared.Core;
|
using BS.Shared.Core;
|
||||||
|
using BS.Shared.DataContracts.ClientPartials;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BeWo.View.Detail
|
namespace BeWo.View.Detail
|
||||||
{
|
{
|
||||||
@@ -13,7 +13,7 @@ namespace BeWo.View.Detail
|
|||||||
{
|
{
|
||||||
public Dictionary<Type, Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>>> Type2Actions { get; set; }
|
public Dictionary<Type, Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>>> Type2Actions { get; set; }
|
||||||
|
|
||||||
public MassnahmenTreeViewView View{ get; set; }
|
public MassnahmenTreeViewView View { get; set; }
|
||||||
|
|
||||||
public GenericValueListEntryListVM ViewModel => View.ViewModel;
|
public GenericValueListEntryListVM ViewModel => View.ViewModel;
|
||||||
public ObservableSortCollection<SupportConceptGoalTreeItem> GoalTree => View.GoalTree;
|
public ObservableSortCollection<SupportConceptGoalTreeItem> GoalTree => View.GoalTree;
|
||||||
@@ -24,11 +24,11 @@ namespace BeWo.View.Detail
|
|||||||
|
|
||||||
Type2Actions = new Dictionary<Type, Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>>>
|
Type2Actions = new Dictionary<Type, Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>>>
|
||||||
{
|
{
|
||||||
{ typeof(MassnahmenHistoryRecordAdd), GetTuple(UndoAddAction, RedoAddAction) },
|
{ typeof(MassnahmenHistoryRecordAdd), GetTuple<MassnahmenHistoryRecordAdd>(UndoAddAction, RedoAddAction) },
|
||||||
{ typeof(MassnahmenHistoryRecordCopy), GetTuple(UndoCopyAction, RedoCopyAction) },
|
{ typeof(MassnahmenHistoryRecordCopy), GetTuple<MassnahmenHistoryRecordCopy>(UndoCopyAction, RedoCopyAction) },
|
||||||
{ typeof(MassnahmenHistoryRecordDelete), GetTuple(UndoDeleteAction, RedoDeleteAction) },
|
{ typeof(MassnahmenHistoryRecordDelete), GetTuple<MassnahmenHistoryRecordDelete>(UndoDeleteAction, RedoDeleteAction) },
|
||||||
{ typeof(MassnahmenHistoryRecordImport), GetTuple(UndoImportAction, RedoImportAction) },
|
{ typeof(MassnahmenHistoryRecordImport), GetTuple<MassnahmenHistoryRecordImport>(UndoImportAction, RedoImportAction) },
|
||||||
{ typeof(MassnahmenHistoryRecordMove), GetTuple(UndoMoveAction, RedoMoveAction) },
|
{ typeof(MassnahmenHistoryRecordMove), GetTuple<MassnahmenHistoryRecordMove>(UndoMoveAction, RedoMoveAction) },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,26 +41,251 @@ namespace BeWo.View.Detail
|
|||||||
{
|
{
|
||||||
Type2Actions[action.GetType()].Item2(action);
|
Type2Actions[action.GetType()].Item2(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UndoAddAction(MassnahmenHistoryRecord param)
|
public MassnahmenHistoryNodeParameter DoAddAction(SupportConceptGoalTreeItem parent, ValueListEntryType valueListEntryType,
|
||||||
|
string description, string abbreviation, string notice)
|
||||||
{
|
{
|
||||||
var addParam = param as MassnahmenHistoryRecordAdd;
|
if (!valueListEntryType.HasFlag(ValueListEntryType.SupportConceptGoalCategoryType) &&
|
||||||
var newItem = addParam.NewTreeItem;
|
!valueListEntryType.HasFlag(ValueListEntryType.SupportConceptGoalType))
|
||||||
var parent = addParam.Parent;
|
throw new ArgumentOutOfRangeException();
|
||||||
|
|
||||||
ViewModel.VMList.Remove(newItem.GoalEntryVM);
|
var vm = ViewModel.NewVM;
|
||||||
|
vm.Type = valueListEntryType;
|
||||||
|
|
||||||
if (parent != null)
|
if (description is object) vm.Description = description;
|
||||||
parent.Items.Remove(newItem);
|
if (abbreviation is object) vm.Abbreviation = abbreviation;
|
||||||
else
|
if (notice is object) vm.Notice = notice;
|
||||||
GoalTree.Remove(newItem);
|
|
||||||
|
var newItem = new SupportConceptGoalTreeItem
|
||||||
|
{
|
||||||
|
GoalEntryVM = vm,
|
||||||
|
GoalEntryDC = vm.CommitToDataContract(),
|
||||||
|
ParentGoal = parent
|
||||||
|
};
|
||||||
|
|
||||||
|
var rtn = new MassnahmenHistoryNodeParameter(newItem, parent);
|
||||||
|
|
||||||
|
ViewModel.AddNewVMToList();
|
||||||
|
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
GoalTree.Add(newItem);
|
||||||
|
return rtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vm.ParentEntry = parent.GoalEntryDC ?? parent.GoalEntryVM.CommitToDataContract();
|
||||||
|
|
||||||
|
parent.Items.Add(newItem);
|
||||||
|
parent.IsExpanded = true;
|
||||||
|
|
||||||
|
return rtn;
|
||||||
|
}
|
||||||
|
private void UndoAddAction(MassnahmenHistoryRecordAdd record)
|
||||||
|
{
|
||||||
|
DeactivateNode(record.Parameter);
|
||||||
|
}
|
||||||
|
private void RedoAddAction(MassnahmenHistoryRecordAdd param) => RedoAddAction(param.Parameter);
|
||||||
|
private void RedoAddAction(MassnahmenHistoryNodeParameter addParam)
|
||||||
|
{
|
||||||
|
ActivateNode(addParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RedoAddAction(MassnahmenHistoryRecord param)
|
public List<MassnahmenHistoryNodeParameter> DoCopyAction(SupportConceptGoalTreeItem parent, SupportConceptGoalTreeItem source,
|
||||||
|
MassnahmenTreeCopyType copyType, bool force_deep_copy,
|
||||||
|
out MassnahmenHistoryNodeParameter current, Stack<MassnahmenHistoryNodeParameter> records = null)
|
||||||
{
|
{
|
||||||
var addParam = param as MassnahmenHistoryRecordAdd;
|
if (records is null)
|
||||||
var newItem = addParam.NewTreeItem;
|
records = new Stack<MassnahmenHistoryNodeParameter>();
|
||||||
var parent = addParam.Parent;
|
|
||||||
|
if (source == null || parent == null)
|
||||||
|
throw new NotImplementedException("#43298467891364987");
|
||||||
|
|
||||||
|
var wm = source.GoalEntryVM;
|
||||||
|
var childs = source.Items.ToList();
|
||||||
|
var param = DoAddAction(parent, wm.Type, wm.Description, wm.Abbreviation, wm.Notice);
|
||||||
|
var node = param.Current;
|
||||||
|
var parameter = new MassnahmenHistoryNodeParameter(node, parent);
|
||||||
|
|
||||||
|
current = parameter;
|
||||||
|
|
||||||
|
records.Push(parameter);
|
||||||
|
|
||||||
|
if (copyType == MassnahmenTreeCopyType.Subtree || force_deep_copy)
|
||||||
|
{
|
||||||
|
foreach (var child in childs)
|
||||||
|
{
|
||||||
|
DoCopyAction(node, child, copyType, force_deep_copy, out var item, records);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return records.ToList();
|
||||||
|
}
|
||||||
|
private void UndoCopyAction(MassnahmenHistoryRecordCopy record)
|
||||||
|
{
|
||||||
|
DeactivateSubtree(record.CurrentNode, record.Parameters);
|
||||||
|
}
|
||||||
|
private void RedoCopyAction(MassnahmenHistoryRecordCopy record)
|
||||||
|
{
|
||||||
|
ActivateSubtree(record.CurrentNode, record.Parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MassnahmenHistoryRecordDelete DoDeleteAction(MassnahmenHistoryNodeParameter param)
|
||||||
|
{
|
||||||
|
// Delete Full Subtree
|
||||||
|
var stack = new Stack<MassnahmenHistoryNodeParameter>();
|
||||||
|
var queue = new Queue<MassnahmenHistoryNodeParameter>();
|
||||||
|
|
||||||
|
DoDeleteActionRec(param.Current, ref stack, ref queue);
|
||||||
|
|
||||||
|
// Queue löschen
|
||||||
|
DeactivateSubtree(param, queue);
|
||||||
|
|
||||||
|
//var list = stack.Select(x => new MassnahmenHistoryNodeParameter(x, View.GetParent(x))).ToList();
|
||||||
|
var node = new MassnahmenHistoryNodeParameter(param.Current, param.Parent);
|
||||||
|
|
||||||
|
return new MassnahmenHistoryRecordDelete(node, stack.ToList());
|
||||||
|
}
|
||||||
|
public void DoDeleteActionRec(SupportConceptGoalTreeItem item, ref Stack<MassnahmenHistoryNodeParameter> stack, ref Queue<MassnahmenHistoryNodeParameter> queue)
|
||||||
|
{
|
||||||
|
foreach (var child in item.Items)
|
||||||
|
{
|
||||||
|
DoDeleteActionRec(child, ref stack, ref queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
var param = new MassnahmenHistoryNodeParameter(item);
|
||||||
|
stack.Push(param);
|
||||||
|
queue.Enqueue(param);
|
||||||
|
}
|
||||||
|
private void UndoDeleteAction(MassnahmenHistoryRecordDelete param)
|
||||||
|
{
|
||||||
|
ActivateSubtree(param.ExNode, param.Parameters);
|
||||||
|
}
|
||||||
|
private void RedoDeleteAction(MassnahmenHistoryRecordDelete param)
|
||||||
|
{
|
||||||
|
DeactivateSubtree(param.ExNode, param.Parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MassnahmenHistoryNodeParameter> DoImportAction(SupportConceptGoalDC goal, List<MassnahmenHistoryNodeParameter> records = null)
|
||||||
|
{
|
||||||
|
if (goal == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (records == null)
|
||||||
|
records = new List<MassnahmenHistoryNodeParameter>();
|
||||||
|
|
||||||
|
goal.Children?.ForEach(x => DoImportAction(x, records));
|
||||||
|
|
||||||
|
if (goal.IsChecked)
|
||||||
|
AddIcf(goal, records);
|
||||||
|
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
private void UndoImportAction(MassnahmenHistoryRecordImport param)
|
||||||
|
{
|
||||||
|
foreach (var item in param.ParametersReversed)
|
||||||
|
{
|
||||||
|
DeactivateNode(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void RedoImportAction(MassnahmenHistoryRecordImport param)
|
||||||
|
{
|
||||||
|
foreach (var item in param.Parameters)
|
||||||
|
{
|
||||||
|
ActivateNode(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MassnahmenHistoryRecordMove DoMoveAction(SupportConceptGoalTreeItem child, SupportConceptGoalTreeItem ex_parent, SupportConceptGoalTreeItem parent)
|
||||||
|
{
|
||||||
|
// Entferne child aus Ex-Parent
|
||||||
|
if (ex_parent is object)
|
||||||
|
ex_parent.Items.Remove(child);
|
||||||
|
else
|
||||||
|
GoalTree.Remove(child);
|
||||||
|
|
||||||
|
// Füge child parent hinzu
|
||||||
|
if (parent is object)
|
||||||
|
parent.Items.Add(child);
|
||||||
|
else
|
||||||
|
GoalTree.Add(child);
|
||||||
|
|
||||||
|
// Setze child Parent Entry
|
||||||
|
child.GoalEntryVM.ParentEntry = parent?.GoalEntryDC;
|
||||||
|
child.ParentGoal = parent;
|
||||||
|
|
||||||
|
return new MassnahmenHistoryRecordMove(child, ex_parent, parent);
|
||||||
|
}
|
||||||
|
private void UndoMoveAction(MassnahmenHistoryRecordMove move)
|
||||||
|
{
|
||||||
|
DoMoveAction(move.Child, move.Parent, move.ExParent);
|
||||||
|
}
|
||||||
|
private void RedoMoveAction(MassnahmenHistoryRecordMove move)
|
||||||
|
{
|
||||||
|
DoMoveAction(move.Child, move.ExParent, move.Parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>> GetTuple<T1>(Action<T1> a, Action<T1> b) where T1 : MassnahmenHistoryRecord
|
||||||
|
=> new Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>>(x => a(x as T1), x => b(x as T1));
|
||||||
|
private SupportConceptGoalTreeItem AddIcf(SupportConceptGoalDC goal, List<MassnahmenHistoryNodeParameter> records)
|
||||||
|
{
|
||||||
|
if (goal == null) return null;
|
||||||
|
|
||||||
|
// Schaut, ob das Child bereits existiert
|
||||||
|
var similarGoal = GoalTree.FirstOrDefault(x => MassnahmenTreeViewView.SearchGoalTreeItem(x, goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice) != null);
|
||||||
|
if (similarGoal != null)
|
||||||
|
return similarGoal;
|
||||||
|
|
||||||
|
// Schaut, ob das Goal ein Parent hat
|
||||||
|
if (goal.ParentGoal == null)
|
||||||
|
{
|
||||||
|
// Ist Root Element
|
||||||
|
var record = DoAddAction(null, ValueListEntryType.SupportConceptGoalCategoryType,
|
||||||
|
goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice);
|
||||||
|
|
||||||
|
records.Add(record);
|
||||||
|
|
||||||
|
//GoalTree.Sort((x, y) => x.GoalEntryVM?.DisplayName?.CompareTo(y.GoalEntryVM?.DisplayName) ?? string.Compare(string.Empty, y.GoalEntryVM?.DisplayName, StringComparison.Ordinal));
|
||||||
|
|
||||||
|
return record.Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schaut, ob das ParentGoal bereits existiert
|
||||||
|
foreach (var goalTreeItem in GoalTree)
|
||||||
|
{
|
||||||
|
var similarParentGoal = MassnahmenTreeViewView.SearchGoalTreeItem(goalTreeItem, goal.ParentGoal.GoalEntryDC.TypeDescription, goal.ParentGoal.GoalEntryDC.Abbreviation, goal.ParentGoal.GoalEntryDC.Notice);
|
||||||
|
if (similarParentGoal == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var record = DoAddAction(similarParentGoal, ValueListEntryType.SupportConceptGoalCategoryType, goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice);
|
||||||
|
records.Add(record);
|
||||||
|
return record.Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fügt den Parent hinzu
|
||||||
|
var parent = AddIcf(goal.ParentGoal, records);
|
||||||
|
var record2 = DoAddAction(parent, ValueListEntryType.SupportConceptGoalCategoryType,
|
||||||
|
goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice);
|
||||||
|
records.Add(record2);
|
||||||
|
return record2.Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ActivateSubtree(MassnahmenHistoryNodeParameter currentNode, List<MassnahmenHistoryNodeParameter> param)
|
||||||
|
{
|
||||||
|
foreach (var item in param)
|
||||||
|
{
|
||||||
|
ViewModel.VMList.Add(item.Current.GoalEntryVM);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentNode.Parent is object)
|
||||||
|
currentNode.Parent.Items.Add(currentNode.Current);
|
||||||
|
else
|
||||||
|
GoalTree.Add(currentNode.Current);
|
||||||
|
}
|
||||||
|
private void ActivateNode(MassnahmenHistoryNodeParameter currentNode)
|
||||||
|
{
|
||||||
|
var newItem = currentNode.Current;
|
||||||
|
var parent = currentNode.Parent;
|
||||||
|
|
||||||
ViewModel.VMList.Add(newItem.GoalEntryVM);
|
ViewModel.VMList.Add(newItem.GoalEntryVM);
|
||||||
|
|
||||||
@@ -70,47 +295,29 @@ namespace BeWo.View.Detail
|
|||||||
GoalTree.Add(newItem);
|
GoalTree.Add(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UndoCopyAction(MassnahmenHistoryRecord obj)
|
private void DeactivateSubtree(MassnahmenHistoryNodeParameter currentNode, IEnumerable<MassnahmenHistoryNodeParameter> param)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
foreach (var item in param)
|
||||||
}
|
{
|
||||||
|
ViewModel.VMList.Remove(item.Current.GoalEntryVM);
|
||||||
|
}
|
||||||
|
|
||||||
private void RedoCopyAction(MassnahmenHistoryRecord obj)
|
if (currentNode.Parent is object)
|
||||||
{
|
currentNode.Parent.Items.Remove(currentNode.Current);
|
||||||
throw new NotImplementedException();
|
else
|
||||||
|
GoalTree.Remove(currentNode.Current);
|
||||||
}
|
}
|
||||||
|
private void DeactivateNode(MassnahmenHistoryNodeParameter currentNode)
|
||||||
|
{
|
||||||
|
var newItem = currentNode.Current;
|
||||||
|
var parent = currentNode.Parent;
|
||||||
|
|
||||||
private void UndoDeleteAction(MassnahmenHistoryRecord obj)
|
ViewModel.VMList.Remove(newItem.GoalEntryVM);
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RedoDeleteAction(MassnahmenHistoryRecord obj)
|
if (parent != null)
|
||||||
{
|
parent.Items.Remove(newItem);
|
||||||
throw new NotImplementedException();
|
else
|
||||||
|
GoalTree.Remove(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UndoImportAction(MassnahmenHistoryRecord obj)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RedoImportAction(MassnahmenHistoryRecord obj)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UndoMoveAction(MassnahmenHistoryRecord obj)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RedoMoveAction(MassnahmenHistoryRecord obj)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>> GetTuple(Action<MassnahmenHistoryRecord> a, Action<MassnahmenHistoryRecord> b)
|
|
||||||
=> new Tuple<Action<MassnahmenHistoryRecord>, Action<MassnahmenHistoryRecord>>(x => a(x), x => b(x));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace BeWo.View.Detail
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ObservableSortCollection<SupportConceptGoalTreeItem> GoalTree { get; private set; }
|
public ObservableSortCollection<SupportConceptGoalTreeItem> GoalTree { get; private set; }
|
||||||
public override bool IsDirty => ViewModel != null && ViewModel.IsDirty;
|
public override bool IsDirty => ViewModel != null && ViewModel.IsDirty || (_History?.GotChanges ?? false);
|
||||||
public static bool IsAllowedToEditGoals => BeWoApp.LoggedOnUser.HasRight(UserRightType.SupportConcept_AllowEditGoals);
|
public static bool IsAllowedToEditGoals => BeWoApp.LoggedOnUser.HasRight(UserRightType.SupportConcept_AllowEditGoals);
|
||||||
|
|
||||||
public GenericValueListEntryListVM ViewModel
|
public GenericValueListEntryListVM ViewModel
|
||||||
@@ -272,18 +272,7 @@ namespace BeWo.View.Detail
|
|||||||
}
|
}
|
||||||
private void ZielHinzufuegenButton_Click(object sender, RoutedEventArgs e)
|
private void ZielHinzufuegenButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var newItem = new SupportConceptGoalTreeItem();
|
AddTreeItem(null, ValueListEntryType.SupportConceptGoalCategoryType);
|
||||||
var vm = ViewModel.NewVM;
|
|
||||||
vm.Type = ValueListEntryType.SupportConceptGoalCategoryType;
|
|
||||||
|
|
||||||
newItem.GoalEntryVM = vm;
|
|
||||||
ViewModel.AddNewVMToList();
|
|
||||||
|
|
||||||
GoalTree.Add(newItem);
|
|
||||||
|
|
||||||
_History.RecordAction(new MassnahmenHistoryRecordAdd(newItem, null));
|
|
||||||
|
|
||||||
SortGoalTree();
|
|
||||||
}
|
}
|
||||||
private void IcfImport_Click(object sender, RoutedEventArgs e)
|
private void IcfImport_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -309,11 +298,7 @@ namespace BeWo.View.Detail
|
|||||||
|
|
||||||
control2.ButtonImportClicked += () =>
|
control2.ButtonImportClicked += () =>
|
||||||
{
|
{
|
||||||
var records = new List<MassnahmenHistoryParameter1>();
|
ImportTreeItem(control2.TreeViewGoalItem);
|
||||||
|
|
||||||
ImportIcf(control2.TreeViewGoalItem, records);
|
|
||||||
|
|
||||||
_History.RecordAction(new MassnahmenHistoryRecordImport(records));
|
|
||||||
|
|
||||||
beWoWindow2.Close();
|
beWoWindow2.Close();
|
||||||
};
|
};
|
||||||
@@ -368,9 +353,7 @@ namespace BeWo.View.Detail
|
|||||||
MessageBox.Show("Kopieren in tiefere Ziele/Maßnamhen nicht möglich!");
|
MessageBox.Show("Kopieren in tiefere Ziele/Maßnamhen nicht möglich!");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var records = new Stack<MassnahmenHistoryParameter1>();
|
CopyTreeItem(_item, _copy, false);
|
||||||
CopyTreeItem(_item, _copy, false, ref records);
|
|
||||||
_History.RecordAction(new MassnahmenHistoryRecordCopy(records.ToList()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void StartMoveItem(SupportConceptGoalTreeItem _draggedItem, SupportConceptGoalTreeItem _parent)
|
private void StartMoveItem(SupportConceptGoalTreeItem _draggedItem, SupportConceptGoalTreeItem _parent)
|
||||||
@@ -661,7 +644,7 @@ namespace BeWo.View.Detail
|
|||||||
textBox.Padding = new Thickness(1, 3, 1, 3);
|
textBox.Padding = new Thickness(1, 3, 1, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static SupportConceptGoalTreeItem SearchGoalTreeItem(SupportConceptGoalTreeItem supportConceptGoalTreeItem,
|
public static SupportConceptGoalTreeItem SearchGoalTreeItem(SupportConceptGoalTreeItem supportConceptGoalTreeItem,
|
||||||
string description, string abbreviation, string notice)
|
string description, string abbreviation, string notice)
|
||||||
{
|
{
|
||||||
if (supportConceptGoalTreeItem?.GoalEntryVM == null) return null;
|
if (supportConceptGoalTreeItem?.GoalEntryVM == null) return null;
|
||||||
@@ -779,60 +762,7 @@ namespace BeWo.View.Detail
|
|||||||
TraverseTreeViewItem(child);
|
TraverseTreeViewItem(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ImportIcf(SupportConceptGoalDC goal, List<MassnahmenHistoryParameter1> records)
|
|
||||||
{
|
|
||||||
if (goal == null) return;
|
|
||||||
|
|
||||||
goal.Children?.ForEach(x => ImportIcf(x, records));
|
|
||||||
|
|
||||||
if (goal.IsChecked)
|
|
||||||
AddIcf(goal, records);
|
|
||||||
}
|
|
||||||
private SupportConceptGoalTreeItem AddIcf(SupportConceptGoalDC goal, List<MassnahmenHistoryParameter1> records)
|
|
||||||
{
|
|
||||||
if (goal == null) return null;
|
|
||||||
|
|
||||||
// Schaut, ob das Child bereits existiert
|
|
||||||
var similarGoal = GoalTree.FirstOrDefault(x => SearchGoalTreeItem(x, goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice) != null);
|
|
||||||
if (similarGoal != null)
|
|
||||||
return similarGoal;
|
|
||||||
|
|
||||||
// Schaut, ob das Goal ein Parent hat
|
|
||||||
if (goal.ParentGoal == null)
|
|
||||||
{
|
|
||||||
var treeItem = AddTreeItem(null, ValueListEntryType.SupportConceptGoalCategoryType,
|
|
||||||
goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice);
|
|
||||||
|
|
||||||
records.Add(new MassnahmenHistoryParameter1(treeItem, null));
|
|
||||||
|
|
||||||
GoalTree.Add(treeItem);
|
|
||||||
|
|
||||||
SortGoalTree();
|
|
||||||
//GoalTree.Sort((x, y) => x.GoalEntryVM?.DisplayName?.CompareTo(y.GoalEntryVM?.DisplayName) ?? string.Compare(string.Empty, y.GoalEntryVM?.DisplayName, StringComparison.Ordinal));
|
|
||||||
|
|
||||||
return treeItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Schaut, ob das ParentGoal bereits existiert
|
|
||||||
foreach (var goalTreeItem in GoalTree)
|
|
||||||
{
|
|
||||||
var similarParentGoal = SearchGoalTreeItem(goalTreeItem, goal.ParentGoal.GoalEntryDC.TypeDescription, goal.ParentGoal.GoalEntryDC.Abbreviation, goal.ParentGoal.GoalEntryDC.Notice);
|
|
||||||
if (similarParentGoal == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var treeItem2 = AddTreeItem(similarParentGoal, ValueListEntryType.SupportConceptGoalCategoryType, goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice);
|
|
||||||
records.Add(new MassnahmenHistoryParameter1(treeItem2, similarParentGoal));
|
|
||||||
return treeItem2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fügt den Parent hinzu
|
|
||||||
var parent = AddIcf(goal.ParentGoal, records);
|
|
||||||
var treeItem3 = AddTreeItem(parent, ValueListEntryType.SupportConceptGoalCategoryType,
|
|
||||||
goal.GoalEntryDC.TypeDescription, goal.GoalEntryDC.Abbreviation, goal.GoalEntryDC.Notice);
|
|
||||||
records.Add(new MassnahmenHistoryParameter1(treeItem3, parent));
|
|
||||||
return treeItem3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddTreeItemWithControl(SupportConceptGoalTreeItem parent, ValueListEntryType valueListEntryType, string viewHeader)
|
public void AddTreeItemWithControl(SupportConceptGoalTreeItem parent, ValueListEntryType valueListEntryType, string viewHeader)
|
||||||
{
|
{
|
||||||
var control = new ValueListEntryEditControl(new ValueListEntryVM(new ValueListEntryDC()), null);
|
var control = new ValueListEntryEditControl(new ValueListEntryVM(new ValueListEntryDC()), null);
|
||||||
@@ -853,9 +783,8 @@ namespace BeWo.View.Detail
|
|||||||
control.SaveButtonClicked += () =>
|
control.SaveButtonClicked += () =>
|
||||||
{
|
{
|
||||||
var vm = control.ValueListEntry;
|
var vm = control.ValueListEntry;
|
||||||
var treeitem = AddTreeItem(parent, valueListEntryType, vm.Description, vm.Abbreviation, vm.Notice);
|
|
||||||
|
|
||||||
_History.RecordAction(new MassnahmenHistoryRecordAdd(treeitem, parent));
|
AddTreeItem(parent, valueListEntryType, vm.Description, vm.Abbreviation, vm.Notice);
|
||||||
|
|
||||||
beWoWindow.Close();
|
beWoWindow.Close();
|
||||||
};
|
};
|
||||||
@@ -868,90 +797,30 @@ namespace BeWo.View.Detail
|
|||||||
beWoWindow.rootGroupBox.Header = viewHeader;
|
beWoWindow.rootGroupBox.Header = viewHeader;
|
||||||
beWoWindow.ShowDialog();
|
beWoWindow.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SupportConceptGoalTreeItem AddTreeItem(SupportConceptGoalTreeItem parent, ValueListEntryType valueListEntryType, string description, string abbreviation, string notice)
|
|
||||||
{
|
|
||||||
if (!valueListEntryType.HasFlag(ValueListEntryType.SupportConceptGoalCategoryType) &&
|
|
||||||
!valueListEntryType.HasFlag(ValueListEntryType.SupportConceptGoalType))
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
|
|
||||||
var vm = ViewModel.NewVM;
|
|
||||||
vm.Type = valueListEntryType;
|
|
||||||
vm.Description = description;
|
|
||||||
vm.Abbreviation = abbreviation;
|
|
||||||
vm.Notice = notice;
|
|
||||||
|
|
||||||
var newItem = new SupportConceptGoalTreeItem
|
|
||||||
{
|
|
||||||
GoalEntryVM = vm,
|
|
||||||
GoalEntryDC = vm.CommitToDataContract(),
|
|
||||||
ParentGoal = parent
|
|
||||||
};
|
|
||||||
|
|
||||||
ViewModel.AddNewVMToList();
|
|
||||||
|
|
||||||
if (parent == null) return newItem;
|
|
||||||
|
|
||||||
vm.ParentEntry = parent.GoalEntryDC ?? parent.GoalEntryVM.CommitToDataContract();
|
|
||||||
|
|
||||||
parent.Items.Add(newItem);
|
|
||||||
parent.IsExpanded = true;
|
|
||||||
|
|
||||||
return newItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private void AddTreeItem(SupportConceptGoalTreeItem parent, ValueListEntryType valueListEntryType, string description = null, string abbreviation = null, string notice = null)
|
||||||
|
{
|
||||||
|
var param = _TreeTrimmer.DoAddAction(parent, valueListEntryType, description, abbreviation, notice);
|
||||||
|
|
||||||
|
_History.RecordAdd(param);
|
||||||
|
}
|
||||||
|
private void ImportTreeItem(SupportConceptGoalDC goal)
|
||||||
|
{
|
||||||
|
var param = _TreeTrimmer.DoImportAction(goal);
|
||||||
|
|
||||||
|
_History.RecordImport(param);
|
||||||
|
}
|
||||||
private void DeleteTreeItem(SupportConceptGoalTreeItem selectedItem)
|
private void DeleteTreeItem(SupportConceptGoalTreeItem selectedItem)
|
||||||
{
|
{
|
||||||
var stack = new Stack<SupportConceptGoalTreeItem>();
|
var del = _TreeTrimmer.DoDeleteAction(new MassnahmenHistoryNodeParameter(selectedItem));
|
||||||
var queue = new Queue<SupportConceptGoalTreeItem>();
|
|
||||||
|
|
||||||
DeleteTreeRec(selectedItem, ref stack, ref queue);
|
_History.RecordDelete(del);
|
||||||
|
|
||||||
// Queue löschen
|
|
||||||
foreach (var item in queue)
|
|
||||||
{
|
|
||||||
ViewModel.VMList.Remove(item.GoalEntryVM);
|
|
||||||
}
|
|
||||||
|
|
||||||
var parent = selectedItem.ParentGoal as SupportConceptGoalTreeItem;
|
|
||||||
if (parent != null)
|
|
||||||
parent.Items.Remove(selectedItem);
|
|
||||||
else
|
|
||||||
GoalTree.Remove(selectedItem);
|
|
||||||
|
|
||||||
var list = stack.Select(x => new MassnahmenHistoryParameter2(x, GetParent(x))).ToList();
|
|
||||||
var action = new MassnahmenHistoryRecordDelete(list);
|
|
||||||
|
|
||||||
_History.RecordAction(action);
|
|
||||||
}
|
}
|
||||||
private void DeleteTreeRec(SupportConceptGoalTreeItem item, ref Stack<SupportConceptGoalTreeItem> stack, ref Queue<SupportConceptGoalTreeItem> queue)
|
private void CopyTreeItem(SupportConceptGoalTreeItem parent, SupportConceptGoalTreeItem source, bool force_deep_copy)
|
||||||
{
|
{
|
||||||
foreach (var child in item.Items)
|
var param = _TreeTrimmer.DoCopyAction(parent, source, _CopyType, force_deep_copy, out var current);
|
||||||
{
|
|
||||||
DeleteTreeRec(child, ref stack, ref queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
stack.Push(item);
|
_History.RecordCopy(current, param);
|
||||||
queue.Enqueue(item);
|
|
||||||
}
|
|
||||||
private void CopyTreeItem(SupportConceptGoalTreeItem parent, SupportConceptGoalTreeItem source, bool force_deep_copy, ref Stack<MassnahmenHistoryParameter1> records)
|
|
||||||
{
|
|
||||||
if (source == null || parent == null)
|
|
||||||
throw new NotImplementedException("#43298467891364987");
|
|
||||||
|
|
||||||
var wm = source.GoalEntryVM;
|
|
||||||
var childs = source.Items.ToList();
|
|
||||||
var node = AddTreeItem(parent, wm.Type, wm.Description, wm.Abbreviation, wm.Notice);
|
|
||||||
|
|
||||||
records.Push(new MassnahmenHistoryParameter1(node, parent));
|
|
||||||
|
|
||||||
if (_CopyType == MassnahmenTreeCopyType.Subtree || force_deep_copy)
|
|
||||||
{
|
|
||||||
foreach (var child in childs)
|
|
||||||
{
|
|
||||||
CopyTreeItem(node, child, force_deep_copy, ref records);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private void MoveTreeItem(SupportConceptGoalTreeItem child, SupportConceptGoalTreeItem parent)
|
private void MoveTreeItem(SupportConceptGoalTreeItem child, SupportConceptGoalTreeItem parent)
|
||||||
{
|
{
|
||||||
@@ -960,17 +829,9 @@ namespace BeWo.View.Detail
|
|||||||
if (ex_parent == parent)
|
if (ex_parent == parent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Entferne child aus Ex-Parent
|
var record = _TreeTrimmer.DoMoveAction(child, ex_parent, parent);
|
||||||
ex_parent.Items.Remove(child);
|
|
||||||
|
|
||||||
// Füge child parent hinzu
|
_History.RecordMove(record);
|
||||||
parent.Items.Add(child);
|
|
||||||
|
|
||||||
// Setze child Parent Entry
|
|
||||||
child.GoalEntryVM.ParentEntry = parent.GoalEntryDC;
|
|
||||||
child.ParentGoal = parent;
|
|
||||||
|
|
||||||
_History.RecordAction(new MassnahmenHistoryRecordMove());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SupportConceptGoalTreeItem GetNearestContainer(UIElement element)
|
private SupportConceptGoalTreeItem GetNearestContainer(UIElement element)
|
||||||
@@ -1023,8 +884,7 @@ namespace BeWo.View.Detail
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public SupportConceptGoalTreeItem GetParent(SupportConceptGoalTreeItem lostchild)
|
||||||
private SupportConceptGoalTreeItem GetParent(SupportConceptGoalTreeItem lostchild)
|
|
||||||
{
|
{
|
||||||
if (lostchild.ParentGoal is SupportConceptGoalTreeItem item)
|
if (lostchild.ParentGoal is SupportConceptGoalTreeItem item)
|
||||||
return item;
|
return item;
|
||||||
@@ -1059,18 +919,13 @@ namespace BeWo.View.Detail
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_History.UndoPrevAction();
|
_History.UndoPrevAction();
|
||||||
|
|
||||||
UpdateHistoryButton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NextButton_Click(object sender, RoutedEventArgs e)
|
private void NextButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_History.GotNextAction)
|
if (!_History.GotNextAction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_History.RedoNextAction();
|
_History.RedoNextAction();
|
||||||
|
|
||||||
UpdateHistoryButton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Groupbox_root_KeyDown(object sender, KeyEventArgs e)
|
private void Groupbox_root_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user