public override void RunCommand(EditorCommand command)
        {
            if (HandleGroupOperation(command))
            {
                return;
            }

            if (HandleChangeTool(command))
            {
                return;
            }

            if (HandleVertexEditor(command))
            {
                return;
            }

            if (HandleSnappingAndHighlighting(command))
            {
                return;
            }

            var map = _context.Map;

            switch (command)
            {
            case EditorCommand.Undo:
            case EditorCommand.UndoPoint:
                map.Undo();
                map.Redraw(RedrawType.SkipDataLayers);
                break;

            case EditorCommand.Redo:
                map.History.Redo();
                map.Redraw(RedrawType.SkipDataLayers);
                break;

            case EditorCommand.ClearSelection:
                _layerService.ClearSelection();
                break;
            }

            _context.View.Update();
        }
Beispiel #2
0
        public void RunCommand(string menuKey)
        {
            if (HandleCursorChanged(menuKey) || HandleProjectCommand(menuKey) || HandleDialogs(menuKey) ||
                HandleHelpMenu(menuKey) || HandleLayerMenu(menuKey) || HandleConfigChanged(menuKey))
            {
                _context.View.Update();
                return;
            }

            switch (menuKey)
            {
            case MenuKeys.ShowRepository:
                DockPanelHelper.ShowPanel(_context, DockPanelKeys.Repository);
                return;     // make sure that no View.Update is called or we lose the focus

            case MenuKeys.ShowToolbox:
                DockPanelHelper.ShowPanel(_context, DockPanelKeys.Toolbox);
                return;     // make sure that no View.Update is called or we lose the focus

            case MenuKeys.SetScale:
                _context.Container.Run <SetScalePresenter>();
                break;

            case MenuKeys.ZoomToBaseLayer:
                ZoomToBaseLayer();
                break;

            case MenuKeys.FindLocation:
                _context.Container.Run <GeoLocationPresenter>();
                break;

            case MenuKeys.CustomProviders:
            {
                var model = _context.Repository.TmsProviders;
                _context.Container.Run <TmsListPresenter, TmsProviderList>(model);
            }
            break;

            case MenuKeys.BingApiKey:
                _context.Container.Run <BingApiPresenter>();
                break;

            case MenuKeys.TilesConfigure:
            {
                var model = _context.Container.GetInstance <ConfigViewModel>();
                model.SelectedPage    = ConfigPageType.Tiles;
                model.UseSelectedPage = true;
                _context.Container.Run <ConfigPresenter, ConfigViewModel>(model);
            }
            break;

            case MenuKeys.PluginsConfigure:
            {
                var model = _context.Container.GetInstance <ConfigViewModel>();
                model.SelectedPage    = ConfigPageType.Plugins;
                model.UseSelectedPage = true;
                _context.Container.Run <ConfigPresenter, ConfigViewModel>(model);
            }
            break;

            case MenuKeys.ZoomPrev:
                _context.Map.ZoomToPrev();
                break;

            case MenuKeys.ZoomNext:
                _context.Map.ZoomToNext();
                break;

            case MenuKeys.ZoomMax:
                _context.Map.ZoomToMaxExtents();
                break;

            case MenuKeys.ZoomToLayer:
                _context.Map.ZoomToLayer(_context.Legend.SelectedLayerHandle);
                break;

            case MenuKeys.RemoveLayer:
                _layerService.RemoveSelectedLayer();
                break;

            case MenuKeys.ClearSelection:
                _layerService.ClearSelection();
                break;

            case MenuKeys.ZoomToSelected:
                _layerService.ZoomToSelected();
                break;

            default:
                MessageService.Current.Info("There is no handler for menu item with key: " + menuKey);
                break;
            }

            _context.View.Update();
        }