예제 #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);
            }
        }
예제 #2
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);
        }