internal AddTransitionRecord(ViewModel.ViewModelController controller, ViewModel.Transition transition) : base(ActionTypes.AddTransition, controller, transition) { TransitionType = transition.TransitionType; DestinationStateId = transition.DestinationStateId; SourceStateId = transition.SourceStateId; TriggerEventId = transition.TriggerEvent?.Id ?? TrackableObject.NullId; ActionIds = transition.ActionReferences.Select(a => a.Action.Id).ToArray(); #if DEBUGUNDOREDO Debug.WriteLine($@">>> AddTransitionRecord.AddTransitionRecord: Created {UnitDescription} record, Id: {Id}, Src: {SourceStateId}, Dest: {DestinationStateId}"); #endif }
public override void Do(IOleUndoManager pUndoManager) { #if DEBUGUNDOREDO Debug.WriteLine(">>> AddTransitionRecord.Do"); #endif using (new ViewModel.ViewModelController.GuiChangeBlock(Controller)) { ViewModel.Transition newTransition = new ViewModel.Transition(Controller, this); Controller.StateMachine.Transitions.Add(newTransition); Controller.UndoManager.Add(new DeleteTransitionRecord(Controller, newTransition)); } }
public override void Do(IOleUndoManager pUndoManager) { #if DEBUGUNDOREDO Debug.WriteLine(">>> DeleteTransitionRecord.Do"); #endif using (new ViewModel.ViewModelController.GuiChangeBlock(Controller)) { ViewModel.Transition targetTransition = Controller.StateMachine.Transitions.Where(s => s.Id == Id).First(); AddTransitionRecord addTransitionRecord = new AddTransitionRecord(Controller, targetTransition); Controller.StateMachine.Transitions.Remove(targetTransition); Controller.UndoManager.Add(addTransitionRecord); } }
public override void Do(IOleUndoManager pUndoManager) { #if DEBUGUNDOREDO Debug.WriteLine(">>> DeleteActionReferenceRecord.Do"); #endif using (new ViewModel.ViewModelController.GuiChangeBlock(Controller)) { ViewModel.Transition targetTransition = Controller.StateMachine.Find(TransitionId) as ViewModel.Transition; ViewModel.ActionReference targetActionReference = targetTransition.ActionReferences[Slot]; targetTransition.ActionReferences.RemoveAt(Slot); Controller.UndoManager.Add(new AddActionReferenceRecord(Controller, targetActionReference, Slot)); } }
internal DeleteTransitionRecord(ViewModel.ViewModelController controller, ViewModel.Transition transition) : base(ActionTypes.AddEventType, controller, transition) { #if DEBUGUNDOREDO Debug.WriteLine($@">>> DeleteTransitionRecord.DeleteTransitionRecord: Created {UnitDescription} record, Id: {Id}"); #endif }