Exemplo n.º 1
0
        public void AddConnectionWithPrompt(GeoDatabaseType?databaseType = null)
        {
            Logger.Current.Trace("In AddConnectionWithPrompt");
            var connection = _databaseService.PromptUserForConnection(databaseType);

            if (connection != null)
            {
                AddConnection(connection);
            }
        }
Exemplo n.º 2
0
        private bool HandleLayerMenu(string itemKey)
        {
            switch (itemKey)
            {
            case MenuKeys.AddWmsLayer:
            {
                var model = new WmsCapabilitiesModel(_context.Repository);
                _context.Container.Run <WmsCapabilitiesPresenter, WmsCapabilitiesModel>(model);
                return(true);
            }

            case MenuKeys.AddDatabaseLayer:
                var connection = _databaseService.PromptUserForConnection();
                if (connection != null)
                {
                    using (var ds = new VectorDatasource())
                    {
                        var model = new DatabaseLayersModel(ds, connection);
                        _context.Container.Run <DatabaseLayersPresenter, DatabaseLayersModel>(model);
                    }
                }
                return(true);

            case MenuKeys.AddLayer:
                _layerService.AddLayer(DataSourceType.All);
                return(true);

            case MenuKeys.AddRasterLayer:
                _layerService.AddLayer(DataSourceType.Raster);
                return(true);

            case MenuKeys.AddVectorLayer:
                _layerService.AddLayer(DataSourceType.Vector);
                return(true);

            case MenuKeys.LayerClearSelection:
                var layer = _context.Legend.SelectedLayer;
                if (layer != null && layer.FeatureSet != null)
                {
                    layer.FeatureSet.ClearSelection();
                    _context.Map.Redraw();
                }
                return(true);

            case MenuKeys.ClearLayers:
                if (MessageService.Current.Ask("Do you wan't to remove all layers from the map?"))
                {
                    _context.Legend.Layers.Clear();
                }
                return(true);
            }

            return(false);
        }