Пример #1
0
        private void AttachLayerToPlugin(ILayer layer, bool isDeserializing = false)
        {
            if (SearchLayerModifier.IsSearchLayer(layer))
            {
                if (_searchLayerInformer == null)
                {
                    // Create popup-informer
                    var extractor = new HISCentralInfoExtractor(new Lazy <Dictionary <string, string> >(() => HisCentralServices.Services));
                    _searchLayerInformer = new SearchLayerInformer(extractor, (Map)App.Map);
                }

                var lm = SearchLayerModifier.Create(layer, (Map)App.Map, this);
                Debug.Assert(lm != null);

                if (!isDeserializing)
                {
                    lm.UpdateLabeling();
                    lm.UpdateSymbolizing();
                }
                lm.UpdateContextMenu();

                btnDownload1.Enabled = true;
                btnDownload2.Enabled = true;
            }

            var group = layer as IGroup;

            if (group != null)
            {
                group.LayerAdded   += Map_LayerAdded;
                group.LayerRemoved += Layers_LayerRemoved;

                foreach (var child in group.GetLayers())
                {
                    AttachLayerToPlugin(child, isDeserializing);
                }
            }
        }
        private void AttachLayerToPlugin(ILayer layer, bool isDeserializing = false)
        {
            if (SearchLayerModifier.IsSearchLayer(layer))
            {
                if (_searchLayerInformer == null)
                {
                    // Create popup-informer
                    var extractor = new HISCentralInfoExtractor(new Lazy <Dictionary <string, string> >(() => new HisCentralServices(App).Services));
                    _searchLayerInformer = new SearchLayerInformer(this, extractor, (Map)App.Map);
                }

                var lm = SearchLayerModifier.Create(layer, (Map)App.Map, this);
                Debug.Assert(lm != null);

                if (!isDeserializing)
                {
                    lm.UpdateLabeling();
                    lm.UpdateSymbolizing();
                }
                lm.UpdateContextMenu();

                if (_btnDownloadInSearch != null)
                {
                    _btnDownloadInSearch.Enabled = true;
                }
                if (_btnSearchOptions != null)
                {
                    _btnSearchOptions.Enabled = true;
                }
                //if (_btnSearchOptions != null)
                //{
                //    _btnSearchOptions.Enabled = true;
                //}
                if (_btnSearchResults != null)
                {
                    _btnSearchResults.Enabled = true;
                }
                if (_btnShowPopups != null)
                {
                    if (!_btnShowPopups.Enabled)
                    {
                        _btnShowPopups.Enabled = true;
                    }
                    if (!ShowPopups)
                    {
                        _btnShowPopups.Toggle();
                    }
                }


                //_btnDownload.Enabled = true;
                //_btnUpdate.Enabled = true;
                //_btnShowPopups.Enabled = true;
            }

            var group = layer as IGroup;

            if (group != null)
            {
                group.LayerAdded   += Map_LayerAdded;
                group.LayerRemoved += Layers_LayerRemoved;

                foreach (var child in group.GetLayers())
                {
                    AttachLayerToPlugin(child, isDeserializing);
                }
            }
        }