Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        private void panel2_DragEnter(object sender, DragEventArgs e)
        {
            if (!e.Data.GetDataPresent(typeof(MatrixGrid)))
            {
                return;
            }
            var grid = (MatrixGrid)e.Data.GetData(typeof(MatrixGrid));
            var t    = grid.side;

            if (sender == workingPanelLeft)
            {
                if (leftNotNull)
                {
                    OperationController <int> .DeleteArgument(this, WorkingPanelSide.Left);
                }
                leftNotNull = true;

                OperationController <int> .ExecuteDragDrop(WorkingPanelSide.Left, grid, this);
            }

            else if (sender == workingPanelRight)
            {
                if (rightNotNull)
                {
                    OperationController <int> .DeleteArgument(this, WorkingPanelSide.Right);
                }
                rightNotNull = true;
                OperationController <int> .ExecuteDragDrop(WorkingPanelSide.Right, grid, this);
            }

            else if (sender == MatrixController <int> .panel)
            {
                MatrixController <int> .ExecuteDragDrop(grid);
            }
            MatrixController <int> .panel.AllowDrop = true;
            workingPanelLeft.AllowDrop  = true;
            workingPanelRight.AllowDrop = true;
            resultPanel.AllowDrop       = true;
            argumentsChanged.Invoke(this, null);
        }