Пример #1
0
        /// <summary>
        /// Perform redo of this command.
        /// </summary>
        public override void Redo()
        {
            //remove the group from the layer
            this.Controller.Model.DefaultPage.DefaultLayer.Entities.Remove(mGroup);
            //detach the entities from the group
            foreach (IDiagramEntity entity in mGroup.Entities)
            {
                //this will be recursive if an entity is itself an IGroup
                entity.Group = null;
                bundle.Entities.Add(entity);
                //mGroup.Entities.Remove(entity);
            }
            //change the visuals such that the entities in the group are selected

            CollectionBase <IDiagramEntity> col = new CollectionBase <IDiagramEntity>();

            col.AddRange(mGroup.Entities);

            Selection.SelectedItems = col;

            mGroup.Invalidate();
            mGroup = null;

            //note that the entities have never been disconnected from the layer
            //so they don't have to be re-attached to the anything.
            //The insertion of the Group simply got pushed in the scene-graph.
        }
Пример #2
0
        /// <summary>
        /// Sets the current page.
        /// </summary>
        /// <param name="page">The page.</param>
        public void SetCurrentPage(IPage page)
        {
            mCurrentPage = page;
            RaiseOnAmbienceChanged(new AmbienceEventArgs(page.Ambience));
            //change the paintables as well
            mPaintables = new CollectionBase <IDiagramEntity>();

            #region Reload of the z-order, usually only necessary after deserialization

            CollectionBase <IDiagramEntity> collected = new CollectionBase <IDiagramEntity>();
            //pick up the non-group entities
            foreach (IDiagramEntity entity in mCurrentPage.DefaultLayer.Entities)
            {
                if (!typeof(IGroup).IsInstanceOfType(entity))
                {
                    collected.Add(entity);
                }
            }

            if (collected.Count > 0)
            {
                Algorithms.SortInPlace <IDiagramEntity>(collected, new SceneIndexComparer <IDiagramEntity>());
                mPaintables.AddRange(collected);
            }
            #endregion
        }