Exemple #1
0
        private void PerformUndo(UndoHistoryItem item)
        {
            undoInProgress.OnNext(true);
            var undoAction = item.UndoAction;

            undoAction(item);
            undoInProgress.OnNext(false);
        }
Exemple #2
0
        private void UndoDefInserted(UndoHistoryItem item)
        {
            var def         = item.DefToUndo;
            var ruleApp     = RuleApplicationService.RuleApplicationDef;
            var lookedUpDef = ruleApp.LookupItem(def.Guid);

            if (lookedUpDef == null)
            {
                LogEvent("{0} does not exist in this RuleAppDef. Nothing to undo.", def.Name);
                return;
            }
            SelectionManager.SelectedItem = lookedUpDef.Parent;
            RuleApplicationService.Controller.RemoveDef(lookedUpDef);
            LogEvent("(UndoDefInserted) - Removed Def {0}", def.Name);
        }
Exemple #3
0
        private void UndoDefRemoved(UndoHistoryItem item)
        {
            var def = item.DefToUndo;

            var ruleApp = RuleApplicationService.RuleApplicationDef;

            if (ruleApp.LookupItem(def.Guid) != null)
            {
                LogEvent("{0} already exists in rule application def. Cannot undo a deletion when the target element is already present", def.Name);
                return;
            }

            var parent = ruleApp.LookupItem(item.ParentGuid) ?? RuleApplicationService.RuleApplicationDef;

            RuleApplicationService.Controller.InsertDef(def, parent, item.OriginalIndex);
            SelectionManager.SelectedItem = def;

            LogEvent("Added Def {0} to parent {1} at position {2}", def.Name, parent.Name, item.OriginalIndex);
        }