public static void DeleteSelection(this InteractiveScene scene) { if (scene.HasSelection) { // Create and perform the delete operation var deleteOperation = new DeleteCommand(scene, scene.SelectedItem); // Store the operation for undo/redo scene.UndoBuffer.AddAndDo(deleteOperation); scene.ClearSelection(); } }
public static void DeleteSelection(this InteractiveScene scene) { var selectedItem = scene.SelectedItem; if (selectedItem != null) { // Create and perform the delete operation var deleteOperation = new DeleteCommand(scene, selectedItem); // Store the operation for undo/redo scene.UndoBuffer.AddAndDo(deleteOperation); scene.ClearSelection(); scene.Invalidate(new InvalidateArgs(null, InvalidateType.Children)); } }