private void MatrixSetup()
        {
            Matrix matrix = new Matrix();

            _appSettings.matrix.SaveTo(matrix);
            Controller.Run <MatrixSetupPresenter, Matrix>(matrix);
            if (!_appSettings.matrix.Equals(matrix))
            {
                _appSettings.matrix = matrix;
                MatrixSizeChanged?.Invoke();
            }
        }
        private void OnMatrixSizeChanged(MatrixSizeChanged e)
        {
            if (e.ColumnsCount.HasValue)
            {
                matrixRepresentation.ChangeColumnsCount(e.ColumnsCount.Value);
            }

            if (e.RowsCount.HasValue)
            {
                matrixRepresentation.ChangeRowsCount(e.RowsCount.Value);
            }

            MatrixView = matrixRepresentation.ToDataView();
            eventStream.Publish(new MatrixChanged());
        }
예제 #3
0
        /// <summary>
        /// Initialize data grid with the given matrix
        /// </summary>
        /// <param name="matrix"></param>
        public void InitMatrix(int[,] matrix)
        {
            MatrixData data    = InitMatrixData(matrix);
            MatrixData oldData = DataContext as MatrixData;

            DataContext = data;

            bool matrixChanged = (oldData == null) || (null != oldData &&
                                                       (oldData.DataTable.Rows.Count != data.DataTable.Rows.Count ||
                                                        oldData.DataTable.Columns.Count != data.DataTable.Columns.Count));

            if (matrixChanged)
            {
                MatrixSizeChanged?.Invoke(this, EventArgs.Empty);
            }
        }
 private void ModifyMatrixSize()
 {
     _appSettings.matrix.cntX = View.MatrixX;
     _appSettings.matrix.cntY = View.MatrixY;
     MatrixSizeChanged?.Invoke();
 }