Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        public static MatrixGrid Calculate(OperationView opView)
        {
            var operationPair = operationsView.Where(e => e.Value == opView).ToList()[0];

            if (operationPair.Key.leftMatrix == null && operationPair.Key.rightMatrix == null)
            {
                var matr = new Matrix <T>(1, 1);
                var gr   = MatrixController <T> .CreateMatrix(matr);

                gr.side = WorkingPanelSide.Result;

                gr.Parent = opView.resultPanel;
                if (operationPair.Key.ResultMatrix != null)
                {
                    MatrixController <T> .DeleteMatrix(operationPair.Key.ResultMatrix);
                }
                operationPair.Key.ResultMatrix = matr;
                return(gr);
            }



            if (operationPair.Key.ResultMatrix != null)
            {
                MatrixController <T> .DeleteMatrix(operationPair.Key.ResultMatrix);
            }
            var t      = MatrixController <T> .matrices;
            var matrix = operationPair.Key.Calculate();
            var grid   = MatrixController <T> .CreateMatrix(matrix);

            var left = MatrixController <T> .GetMatrixGrid(operationPair.Key.leftMatrix);

            grid.lines  = matrix.lines;
            grid.Parent = opView.resultPanel;
            grid.side   = WorkingPanelSide.Result;
            return(grid);
        }