コード例 #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);
        Controller.Model.AddEntity(entity);
      }
      //change the visuals such that the entities in the group are selected

      CollectionBase<IDiagramEntity> col = new CollectionBase<IDiagramEntity>();
      col.AddRange(mGroup.Entities);

      this.Controller.Model.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>
        /// 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);
                Controller.Model.AddEntity(entity);
            }
            //change the visuals such that the entities in the group are selected

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

            col.AddRange(mGroup.Entities);

            this.Controller.Model.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.
        }
コード例 #3
0
ファイル: ArticleBase.cs プロジェクト: t00ks/TooksCms
        public static CollectionBase <ArticleBase> GetList(int count, string type, IArticleRepository rep)
        {
            var articleBases = new CollectionBase <ArticleBase>();

            articleBases.AddRange(rep.FetchList(count, type).Select(article => ((ArticleBase)Reflector.CreateObject(article.ArticleType.Assembly, article.ArticleType.Class)).
                                                                    Desrialize(article.Content.ToString())));
            articleBases.ForEach(ab => ab.MarkOld());
            return(articleBases);
        }
コード例 #4
0
ファイル: ArticleBase.cs プロジェクト: t00ks/TooksCms
        public static CollectionBase <ArticleBase> Search(string search, IArticleRepository rep)
        {
            search = search.ToLower();
            var articleBases = new CollectionBase <ArticleBase>();

            articleBases.AddRange(rep.Search(search).Select(article => ((ArticleBase)Reflector.CreateObject(article.ArticleType.Assembly, article.ArticleType.Class)).
                                                            Desrialize(article.Content.ToString())));
            articleBases.ForEach(ab => ab.MarkOld());
            return(articleBases);
        }
コード例 #5
0
        public static CollectionBase <BulletinBase> GetAll(ILookupRepository lRep, IBulletinRepository bRep)
        {
            var bulletins = new CollectionBase <BulletinBase>();

            bulletins.AddRange(bRep.FetchList().Select(bulletin =>
                                                       ((BulletinBase)Reflector.CreateObject(bulletin.BulletinType.Assembly, bulletin.BulletinType.Class, new[] { bulletin })).
                                                       Desrialize(bulletin.Content.ToString())));
            bulletins.ForEach(b =>
            {
                b.MarkOld();
                b.LoadCategoryInfo(lRep);
            });
            return(bulletins);
        }
コード例 #6
0
ファイル: Document.cs プロジェクト: radtek/HeuristicLabPlay
        // ------------------------------------------------------------------
        /// <summary>
        /// Loops through all pages and returns ALL entities that belong to
        /// this Document.
        /// </summary>
        /// <returns>CollectionBase</returns>
        // ------------------------------------------------------------------
        public CollectionBase <IDiagramEntity> GetAllEntities()
        {
            CollectionBase <IDiagramEntity> entities =
                new CollectionBase <IDiagramEntity>();

            foreach (IPage page in this.mModel.Pages)
            {
                foreach (ILayer layer in page.Layers)
                {
                    entities.AddRange(layer.Entities);
                }
            }
            return(entities);
        }
コード例 #7
0
ファイル: Document.cs プロジェクト: thunder176/HeuristicLab
 // ------------------------------------------------------------------
 /// <summary>
 /// Loops through all pages and returns ALL entities that belong to
 /// this Document.
 /// </summary>
 /// <returns>CollectionBase</returns>
 // ------------------------------------------------------------------
 public CollectionBase<IDiagramEntity> GetAllEntities() {
   CollectionBase<IDiagramEntity> entities =
           new CollectionBase<IDiagramEntity>();
   foreach (IPage page in this.mModel.Pages) {
     foreach (ILayer layer in page.Layers) {
       entities.AddRange(layer.Entities);
     }
   }
   return entities;
 }
コード例 #8
0
ファイル: Model.cs プロジェクト: xuchuansheng/GenXSource
        /// <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
        }