public static void DeleteArgument(OperationView opView, WorkingPanelSide side) { var operationList = operationsView.Where(e => e.Value == opView).ToList(); //if (operationList.Count == 0) // return; var operationPair = operationList[0]; if (side == WorkingPanelSide.Left && operationPair.Key.leftMatrix != null) { MatrixController <T> .DeleteMatrix(operationPair.Key.leftMatrix); } else if (side == WorkingPanelSide.Right && operationPair.Key.rightMatrix != null) { MatrixController <T> .DeleteMatrix(operationPair.Key.rightMatrix); } else if (side == WorkingPanelSide.Result && operationPair.Key.ResultMatrix != null) { MatrixController <T> .DeleteMatrix(operationPair.Key.ResultMatrix); } }
public static void ExecuteDragDrop(WorkingPanelSide side, MatrixGrid grid, OperationView opView) { var operationPair = operationsView.Where(e => e.Value == opView).ToList()[0]; var oldMatrix = MatrixController <T> .matricesView.Where(e => e.Value == grid).ToList(); var matrix = (Matrix <T>)oldMatrix[0].Key.Clone(); var newGrid = MatrixController <T> .CreateMatrix(matrix); if (side == WorkingPanelSide.Left) { newGrid.Parent = operationPair.Value.workingPanelLeft; newGrid.side = WorkingPanelSide.Left; operationPair.Key.leftMatrix = matrix; matrix.Changed += (o, e) => operationPair.Value.argumentsChanged.Invoke(matrix, null); matrix.DisposeEvent += (o, e) => { operationPair.Value.leftNotNull = false; }; } else if (side == WorkingPanelSide.Right) { newGrid.Parent = operationPair.Value.workingPanelRight; newGrid.side = WorkingPanelSide.Right; operationPair.Key.rightMatrix = matrix; matrix.Changed += (o, e) => operationPair.Value.argumentsChanged.Invoke(matrix, null); matrix.DisposeEvent += (o, e) => { operationPair.Value.rightNotNull = false; }; } newGrid.lines = matrix.lines; newGrid.MatrixName = grid.MatrixName; if (grid.dragDropExecuted != null) { grid.dragDropExecuted.Invoke(newGrid, null); } }