Пример #1
0
        private void UnloadLayer(IEntityDesignerLayer layer)
        {
            if (_artifact != null &&
                _artifact.ConceptualModel() != null)
            {
                layer.OnBeforeLayerUnloaded(_artifact.ConceptualModel().XObject);
            }

            foreach (var command in GetCommands(layer))
            {
                RemoveCommand(command);
            }

            layer.ChangeEntityDesignerSelection -= layer_EntityDesignerSelectionChanged;

            if (_selectionContainer != null)
            {
                _selectionContainer.Dispose();
                _selectionContainer = null;
            }
        }
Пример #2
0
        private void LoadLayer(IEntityDesignerLayer layer, XObject selectedXObject)
        {
            if (_artifact != null &&
                _artifact.ConceptualModel() != null)
            {
                if (selectedXObject != null)
                {
                    layer.OnAfterLayerLoaded(selectedXObject);
                }
                else
                {
                    layer.OnAfterLayerLoaded(_artifact.ConceptualModel().XObject);
                }
            }

            if (layer.ServiceProvider != null &&
                PackageManager.Package.DocumentFrameMgr != null &&
                PackageManager.Package.DocumentFrameMgr.EditingContextManager != null)
            {
                if (PackageManager.Package.DocumentFrameMgr.EditingContextManager.DoesContextExist(_artifact.Uri))
                {
                    var editingContext = PackageManager.Package.DocumentFrameMgr.EditingContextManager.GetNewOrExistingContext(
                        _artifact.Uri);
                    Debug.Assert(editingContext != null, "EditingContext must not be null if we found that a context exists");
                    if (editingContext != null)
                    {
                        // TODO there should be one independent selection container for each layer.
                        _selectionContainer = new EntityDesignSelectionContainer <LayerSelection>(layer.ServiceProvider, editingContext);
                    }
                }
            }

            layer.ChangeEntityDesignerSelection += layer_EntityDesignerSelectionChanged;
            foreach (var command in GetCommands(layer))
            {
                AddCommand(command);
            }
        }