public override HistoryMemento PerformUndo() { HistoryMemento redoMemento = new HistoryMementoAddKeyframe(metadata, keyframeId); redoMemento.CommandName = commandName; Keyframe keyframe = KeyframeSerializer.DeserializeMemento(data, metadata); metadata.AddKeyframe(keyframe); return(redoMemento); }
private void View_KeyframeAdding(object sender, TimeEventArgs e) { if (frameServer.CurrentImage == null) { return; } long time = e.Time; string timecode = frameServer.TimeStampsToTimecode(time, TimeType.UserOrigin, PreferencesManager.PlayerPreferences.TimecodeFormat, true); Keyframe keyframe = new Keyframe(time, timecode, frameServer.Metadata); HistoryMementoAddKeyframe memento = new HistoryMementoAddKeyframe(frameServer.Metadata, keyframe.Id); frameServer.Metadata.AddKeyframe(keyframe); historyStack.PushNewCommand(memento); }