private void PluginManager_MenuItemClicked(object sender, MenuItemEventArgs e)
        {
            var menuItem = sender as IMenuItem;

            if (menuItem == null)
            {
                throw new InvalidCastException("Invalid type of menu item. IMenuItem interface is expected");
            }

            switch (e.ItemKey)
            {
            case StatusBarKeys.MapScale:
                _context.Container.Run <SetScalePresenter>();
                break;

            case StatusBarKeys.ProjectionDropDown:
                if (_context.Map.Projection.IsEmpty)
                {
                    _context.ChangeProjection();
                }
                else
                {
                    _context.ShowMapProjectionProperties();
                }
                break;

            case StatusBarKeys.ProjectionProperties:
                _context.ShowMapProjectionProperties();
                break;

            case StatusBarKeys.ChooseProjection:
                _context.ChangeProjection();
                break;

            case StatusBarKeys.ProjectionConfig:
                var model = _context.Container.GetInstance <ConfigViewModel>();
                model.UseSelectedPage = true;
                model.SelectedPage    = ConfigPageType.Projections;
                _context.Container.Run <ConfigPresenter, ConfigViewModel>(model);
                break;

            default:
                // do nothing
                break;
            }
        }
Exemple #2
0
        private bool HandleDialogs(string itemKey)
        {
            switch (itemKey)
            {
            case MenuKeys.Settings:
                var model = _context.Container.GetInstance <ConfigViewModel>();
                _context.Container.Run <ConfigPresenter, ConfigViewModel>(model);
                return(true);

            case MenuKeys.SetProjection:
                if (_context.Map.Projection.IsEmpty)
                {
                    _context.ChangeProjection();
                }
                else
                {
                    _context.ShowMapProjectionProperties();
                }
                return(true);
            }
            return(false);
        }