示例#1
0
        internal void Load()
        {
            // Load all the layers first
            var extensions = EscherExtensionPointManager.LoadLayerExtensions();

            if (extensions != null)
            {
                var selectedEFElement = SelectedEFObject as EFElement;
                foreach (var ex in extensions)
                {
                    var layer = ex.Value;
                    if (layer != null)
                    {
                        var isLayerEnabled = IsLayerEnabled(layer.Name);
                        EntityDesignerCommand enableCommand;
                        var addedCommand = AddEnableLayerCommand(layer, isLayerEnabled, out enableCommand);
                        if (addedCommand && enableCommand != null)
                        {
                            if (isLayerEnabled)
                            {
                                LoadLayer(layer, selectedEFElement != null ? selectedEFElement.XObject : null);
                            }

                            var layerState = new LayerState {
                                IsEnabled = isLayerEnabled, EnableCommand = enableCommand
                            };
                            _layer2state.Add(layer, layerState);
                        }
                    }
                }
            }

            // TODO Now we load the commands from the command factories. At some point we should move this out of the layer manager
            // into a more global object (not tied to the lifetime of the artifact)
            foreach (var command in GetCommands())
            {
                AddCommand(command);
            }
            ListenToSelections();
        }