Ejemplo n.º 1
0
        public void CalculateCachedData()
        {
            if (IsDisposeInProgress)
            {
                return;
            }

            // we can calulate the bounds only if they are set before
            if (null == _xBoundaries && null == _yBoundaries && null == _zBoundaries)
            {
                return;
            }

            ISuspendToken suspendTokenX = null;
            ISuspendToken suspendTokenY = null;
            ISuspendToken suspendTokenZ = null;

            suspendTokenX = _xBoundaries?.SuspendGetToken();
            suspendTokenY = _yBoundaries?.SuspendGetToken();
            suspendTokenZ = _zBoundaries?.SuspendGetToken();

            try
            {
                _xBoundaries?.Reset();
                _yBoundaries?.Reset();
                _zBoundaries?.Reset();

                _pointCount = GetMaximumRowIndexFromDataColumns();

                IReadableColumn xColumn = XColumn;
                IReadableColumn yColumn = YColumn;
                IReadableColumn zColumn = ZColumn;

                foreach (var segment in _dataRowSelection.GetSelectedRowIndexSegmentsFromTo(0, _pointCount, _dataTable?.Document?.DataColumns, _pointCount))
                {
                    for (int rowIdx = segment.start; rowIdx < segment.endExclusive; ++rowIdx)
                    {
                        if (!xColumn.IsElementEmpty(rowIdx) && !yColumn.IsElementEmpty(rowIdx) && !zColumn.IsElementEmpty(rowIdx))
                        {
                            _xBoundaries?.Add(xColumn, rowIdx);
                            _yBoundaries?.Add(yColumn, rowIdx);
                            _zBoundaries?.Add(zColumn, rowIdx);
                        }
                    }
                }

                // now the cached data are valid
                _isCachedDataValidX = null != _xBoundaries;
                _isCachedDataValidY = null != _yBoundaries;
                _isCachedDataValidZ = null != _zBoundaries;

                // now when the cached data are valid, we can reenable the events
            }
            finally
            {
                suspendTokenX?.Resume();
                suspendTokenY?.Resume();
                suspendTokenZ?.Resume();
            }
        }
Ejemplo n.º 2
0
        public void CalculateCachedData()
        {
            if (IsDisposeInProgress)
            {
                return;
            }

            if (0 == RowCount || 0 == ColumnCount)
            {
                return;
            }

            using (var suspendTokenX = _xBoundaries.SuspendGetToken())
            {
                using (var suspendTokenY = _yBoundaries.SuspendGetToken())
                {
                    using (var suspendTokenV = _vBoundaries.SuspendGetToken())
                    {
                        _xBoundaries.Reset();
                        _yBoundaries.Reset();
                        _vBoundaries.Reset();

                        _matrixProxy.ForEachMatrixElementDo((col, idx) => _vBoundaries.Add(col, idx));
                        _matrixProxy.ForEachRowHeaderElementDo((col, idx) => _xBoundaries.Add(col, idx));
                        _matrixProxy.ForEachColumnHeaderElementDo((col, idx) => _yBoundaries.Add(col, idx));

                        // now the cached data are valid
                        _isCachedDataValid = true;

                        // now when the cached data are valid, we can reenable the events
                        suspendTokenV.Resume();
                    }
                    suspendTokenY.Resume();
                }
                suspendTokenX.Resume();
            }
        }