Exemplo n.º 1
0
        public void EhView_MoveUpGroupStyle()
        {
            if (0 == _currentStepItems || _currentNormalStyles[0].Selected)
            {
                return; // can not move up any more
            }
            for (int i = 1; i < _currentStepItems; i++)
            {
                CheckableSelectableListNode selected = _currentNormalStyles[i];
                if (!selected.Selected)
                {
                    continue;
                }

                IPlotGroupStyle style      = _doc.GetPlotGroupStyle((Type)selected.Item);
                Type            parenttype = _doc.GetParentTypeOf(style.GetType());
                _doc.RemoveType(style.GetType()); // Removing the type so removing also the parent-child-relationship
                if (parenttype == null)
                {
                    _doc.Add(style);
                }
                else
                {
                    _doc.Insert(style, parenttype); // Add the type, but parent type is this time the child type
                }
                _currentNormalStyles.Exchange(i, i - 1);
            }
            // this requires the whole currentNormalStyle list to be updated
            UpdateCurrentNormalOrder();
            _view.InitializeCurrentNormalGroupStyles(_currentNormalStyles);
        }