private void SelectLayer(Guid layerUid) { if (_selectedLayer == layerUid) return; if (_selectedLayerRef != null) { UnbindSelectedLayerEvents(_selectedLayerRef); ICommandSubscriber comLayer = _selectedLayerRef as ICommandSubscriber; if (comLayer != null) { _commandManager.RemoveCommandSubscriber(comLayer); } _selectedLayerRef.Deactivate(); } if (layerUid == null || !_layerPresenters.ContainsKey(layerUid)) { _selectedLayer = Guid.Empty; _selectedLayerRef = null; InvalidateLayerCommands(); RefreshGridVisibility(); OnPointerEventResponderChanged(EventArgs.Empty); return; } _selectedLayer = layerUid; _selectedLayerRef = _layerPresenters[_selectedLayer]; _info.ActionUpdateCoordinates(""); _gridLayer.IsVisible = true; if (_selectedLayerRef != null) { BindSelectedLayerEvents(_selectedLayerRef); ICommandSubscriber comLayer = _selectedLayerRef as ICommandSubscriber; if (comLayer != null) { _commandManager.AddCommandSubscriber(comLayer); } if (_selectedLayerRef is LevelLayerPresenter) { //_gridLayer.IsVisible = CommandManager.IsSelected(CommandKey.ViewGrid); _gridLayer.GridColor = (_selectedLayerRef as LevelLayerPresenter).Layer.GridColor; _gridLayer.GridSpacingX = (_selectedLayerRef as LevelLayerPresenter).Layer.GridWidth; _gridLayer.GridSpacingY = (_selectedLayerRef as LevelLayerPresenter).Layer.GridHeight; } _selectedLayerRef.Activate(); } InvalidateLayerCommands(); OnPointerEventResponderChanged(EventArgs.Empty); _info.RefreshContentInfo(); }