Esempio n. 1
0
        public override IEnumerable <ControllerAndSetNullMethod> GetSubControllers()
        {
            yield return(new ControllerAndSetNullMethod(_coordinateController, () => _coordinateController = null));

            yield return(new ControllerAndSetNullMethod(_layerPositionController, () => _layerPositionController = null));

            yield return(new ControllerAndSetNullMethod(_layerContentsController, () => _layerContentsController = null));

            if (null != _axisScaleController)
            {
                for (int i = 0; i < _axisScaleController.Length; ++i)
                {
                    yield return(new ControllerAndSetNullMethod(_axisScaleController[i], () => _axisScaleController[i] = null));
                }
            }

            yield return(new ControllerAndSetNullMethod(_layerGraphItemsController, () => _layerGraphItemsController = null));

            if (null != _GridStyleController)
            {
                foreach (var entry in _GridStyleController)
                {
                    yield return(new ControllerAndSetNullMethod(entry.Value, null));
                }
            }

            yield return(new ControllerAndSetNullMethod(null, () => _GridStyleController = null));

            if (null != _axisControl)
            {
                foreach (var entry in _axisControl)
                {
                    yield return(new ControllerAndSetNullMethod(entry.Value.AxisStyleCondController, null));

                    yield return(new ControllerAndSetNullMethod(entry.Value.MajorLabelCondController, null));

                    yield return(new ControllerAndSetNullMethod(entry.Value.MinorLabelCondController, null));
                }
            }
            yield return(new ControllerAndSetNullMethod(null, () => _axisControl = null));
        }
Esempio n. 2
0
        private void SetCurrentTabController(bool pageChanged)
        {
            switch (_currentPageName)
            {
            case "GraphicItems":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                }
                if (null == _layerGraphItemsController)
                {
                    _layerGraphItemsController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.GraphObjects }, typeof(IMVCANController), UseDocument.Directly);
                }
                _currentController   = _layerGraphItemsController;
                _view.CurrentContent = _currentController.ViewObject;
                break;

            case "Contents":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToUnique();
                }
                if (null == _layerContentsController)
                {
                    _layerContentsController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.PlotItems }, typeof(IMVCANController), UseDocument.Directly);
                }
                _currentController   = _layerContentsController;
                _view.CurrentContent = _currentController.ViewObject;
                break;

            case "Position":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToUnique();
                }
                if (null == _layerPositionController)
                {
                    _layerPositionController = new LayerPositionController()
                    {
                        UseDocumentCopy = UseDocument.Directly
                    };
                    _layerPositionController.InitializeDocument(_doc.Location, _doc);
                    Current.Gui.FindAndAttachControlTo(_layerPositionController);
                }
                _currentController   = _layerPositionController;
                _view.CurrentContent = _layerPositionController.ViewObject;
                break;

            case "Scale":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToScales();
                }
                if (_axisScaleController[_currentScale] == null)
                {
                    var ctrl = new ScaleWithTicksController(scale => _doc.Scales[_currentScale] = scale, false);
                    ctrl.InitializeDocument(_doc.Scales[_currentScale]);
                    _axisScaleController[_currentScale] = ctrl;
                    Current.Gui.FindAndAttachControlTo(_axisScaleController[_currentScale]);
                }
                _currentController   = _axisScaleController[_currentScale];
                _view.CurrentContent = _currentController.ViewObject;
                break;

            case "CS":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToUnique();
                }
                if (null == _coordinateController)
                {
                    _coordinateController = new Altaxo.Gui.Graph.Gdi.CoordinateSystemController()
                    {
                        UseDocumentCopy = UseDocument.Directly
                    };
                    _coordinateController.InitializeDocument(_doc.CoordinateSystem);
                    Current.Gui.FindAndAttachControlTo(_coordinateController);
                }
                _currentController   = _coordinateController;
                _view.CurrentContent = _coordinateController.ViewObject;
                break;

            case "GridStyle":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToPlanes();
                }

                if (!_GridStyleController.ContainsKey(_currentPlaneID))
                {
                    GridPlane p    = _doc.GridPlanes.Contains(_currentPlaneID) ? _doc.GridPlanes[_currentPlaneID] : new GridPlane(_currentPlaneID);
                    var       ctrl = new GridPlaneController()
                    {
                        UseDocumentCopy = UseDocument.Directly
                    };
                    ctrl.InitializeDocument(p);
                    Current.Gui.FindAndAttachControlTo(ctrl);
                    _GridStyleController.Add(_currentPlaneID, ctrl);
                }
                _currentController   = _GridStyleController[_currentPlaneID];
                _view.CurrentContent = _currentController.ViewObject;

                break;

            case "TitleAndFormat":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToAxes();
                }

                _view.CurrentContent = _axisControl[_currentAxisID].AxisStyleCondView;
                _currentController   = _axisControl[_currentAxisID].AxisStyleCondController;

                break;

            case "MajorLabels":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToAxes();
                }

                _view.CurrentContent = _axisControl[_currentAxisID].MajorLabelCondView;
                _currentController   = _axisControl[_currentAxisID].MajorLabelCondController;

                break;

            case "MinorLabels":
                if (pageChanged)
                {
                    _view.SelectTab(_currentPageName);
                    SetSecondaryChoiceToAxes();
                }

                _view.CurrentContent = _axisControl[_currentAxisID].MinorLabelCondView;
                _currentController   = _axisControl[_currentAxisID].MinorLabelCondController;

                break;
            }
        }