public void Undo() { if (isMatrixController) { if (matrix != null) { if (grid.side == WorkingPanelSide.List) { MatrixController <T> .CreateMatrix(matrix); } else { //костыль (: //зато работает! var side = grid.side; grid = MatrixController <T> .CreateMatrix(matrix); OperationController <T> .ExecuteDragDrop(side, grid, opView); MatrixController <T> .DeleteMatrix(matrix); } } } else { //тоже костыль :( opView = OperationController <T> .CreateEmptyOperation(); var left = operation.leftMatrix; var right = operation.rightMatrix; if (left != null) { var leftGrid = MatrixController <T> .CreateMatrix(left); OperationController <T> .ExecuteDragDrop(WorkingPanelSide.Left, leftGrid, opView); MatrixController <T> .DeleteMatrix(leftGrid); } if (right != null) { var rightGrid = MatrixController <T> .CreateMatrix(right); OperationController <T> .ExecuteDragDrop(WorkingPanelSide.Right, rightGrid, opView); MatrixController <T> .DeleteMatrix(rightGrid); } } }
public void Execute() { if (type == CreationType.Matrix) { if (data.GetLength(0) != 0 || data.GetLength(1) != 0) { grid = MatrixController <T> .CreateMatrix(data); } grid.MatrixName = name; } else { opView = OperationController <T> .CreateEmptyOperation(); } }