示例#1
0
        private void BindTilePool(TilePoolPresenter tilePool)
        {
            if (_tilePool != null)
            {
                _tilePool.LevelGeometry = null;
            }
            if (_layerControl.RootLayer != null)
            {
                _layerControl.RootLayer.Dispose();
                _layerControl.RootLayer = null;
            }

            _tilePool = tilePool;
            if (_tilePool != null)
            {
                _tilePool.LevelGeometry = _layerControl.LevelGeometry;

                _root = new GroupLayer(tilePool.RootLayer);

                _layerControl.RootLayer = _root;
                //_pointerController.Responder = tilePool.PointerEventResponder;
                _pointerController.Responder = new LocalPointerEventResponder(this, tilePool.PointerEventResponder);
            }
            else
            {
                _root = null;
                _pointerController.Responder = null;
            }
        }
        private void SelectTilePool(Guid poolUid)
        {
            if (_selectedPool == poolUid)
                return;

            if (poolUid == null || !_tilePoolPresenters.ContainsKey(poolUid)) {
                _selectedPool = Guid.Empty;
                _selectedPoolRef = null;
                _commandManager.Invalidate(CommandKey.TilePoolProperties);

                return;
            }

            _selectedPool = poolUid;
            _selectedPoolRef = _tilePoolPresenters[poolUid];

            _commandManager.Invalidate(CommandKey.TilePoolProperties);
            _commandManager.Invalidate(CommandKey.TilePoolDelete);
            _commandManager.Invalidate(CommandKey.TilePoolImportMerge);
            _commandManager.Invalidate(CommandKey.TilePoolRename);
            _commandManager.Invalidate(CommandKey.TilePoolExport);
            _commandManager.Invalidate(CommandKey.TilePoolImportOver);

            OnSelectedTilePoolChanged(EventArgs.Empty);
        }
        private void ClearPoolPresenters()
        {
            foreach (TilePoolPresenter presenter in _tilePoolPresenters.Values)
                presenter.Dispose();

            _tilePoolPresenters.Clear();
            _selectedPool = Guid.Empty;
            _selectedPoolRef = null;
        }
        private void AddPoolPresenter(TilePool pool)
        {
            TilePoolPresenter presenter = new TilePoolPresenter(pool);
            presenter.SelectedTileChanged += SelectedTileChanged;

            _tilePoolPresenters[pool.Uid] = presenter;
        }