public static void Perform(Node container, Marker marker, bool removeDependencies) { var previousMarker = container.Markers.GetByFrame(marker.Frame); DocumentHistory.Current.Perform(new SetMarker(container, marker, removeDependencies)); if (removeDependencies) { // Detect if a previous marker id is unique then rename it in triggers and markers. if (previousMarker != null && previousMarker.Id != marker.Id && container.Markers.All(markerEl => markerEl.Id != previousMarker.Id)) { foreach (var markerEl in container.Markers.ToList()) { if (markerEl.Action == MarkerAction.Jump && markerEl.JumpTo == previousMarker.Id) { SetProperty.Perform(markerEl, nameof(markerEl.JumpTo), marker.Id); } } ProcessAnimableProperty.Perform(container, nameof(Node.Trigger), (string value, out string newValue) => { return(TriggersValidation.TryRenameMarkerInTrigger( previousMarker.Id, marker.Id, value, out newValue )); } ); } } }
public static void Perform(Node container, Marker marker, bool removeDependencies) { DocumentHistory.Current.Perform(new DeleteMarker(container, marker, removeDependencies)); if (removeDependencies) { ProcessAnimableProperty.Perform(container, nameof(Node.Trigger), (string value, out string newValue) => { return(TriggersValidation.TryRemoveMarkerFromTrigger(marker.Id, value, out newValue)); } ); } }