示例#1
0
文件: DataSet.cs 项目: Levrum/Levrum
        public void AddRange(IEnumerable <T> range)
        {
            if (Parent == null)
            {
                Contents.AddRange(range);
                return;
            }

            Type type = typeof(T);

            PropertyInfo[] properties = type.GetProperties();
            PropertyInfo   info       = (from PropertyInfo p in properties
                                         where p.Name is "Parent"
                                         select p).FirstOrDefault();

            T[] items = range.ToArray();
            if (info != default(PropertyInfo))
            {
                Type parentType = Parent.GetType();
                if (info.PropertyType == parentType)
                {
                    foreach (T item in items)
                    {
                        info.SetValue(item, Parent);
                    }
                }
            }

            Contents.AddRange(items);
        }
示例#2
0
        private void BuildTestClass(NodeFeature feature)
        {
            List <string>   privateContents   = new List <string>();
            List <string>   publicContents    = new List <string>();
            List <NodeStep> filterUniqueSteps = new List <NodeStep>();

            foreach (var scenario in feature.Scenarios)
            {
                AddScenario(scenario, feature.Hooks, publicContents);
                if ((scenario.Steps.Count > 0) && (feature.Scenarios.First() == scenario))
                {
                    OpenTestClassPrivateSection(privateContents);
                }
                AddSteps(GeneratorHelper.FindUniqueSteps(filterUniqueSteps, scenario.Steps), scenario, privateContents);
            }

            OpenTestClassPublicSection(feature.Hooks);

            Contents.AddRange(publicContents);

            if (privateContents.Count > 0)
            {
                Contents.AddRange(privateContents);
            }
        }
 private void BuildHeaderStatement()
 {
     if (LanguageConfig.UseHeader)
     {
         Contents.AddRange(LanguageConfig.headerStatementsInStepDefinition);
         Contents.Add(string.Empty);
     }
 }
 private void BuildIncludeStatement()
 {
     if (LanguageConfig.UseInclude)
     {
         Contents.AddRange(LanguageConfig.includeStatementsInStepDefinition);
         Contents.Add(string.Empty);
     }
 }
        public ActionResult Articles()
        {
            var model1 = new Contents();
            model1.GetContentForUser(Convert.ToInt32(_mu.ProviderUserKey));

            var model = new Contents();
            model.AddRange(model1.OrderByDescending(p => p.CreateDate));

            return View(model);
        }
示例#6
0
 public Group(List <Shape> colShapes)
 {
     Contents.AddRange(colShapes);
     m_Bounds = RectangleF.Empty;
     foreach (Shape shape in Contents)
     {
         shape.Parent = this;
         shape.NotifyEnvironmentChanged(EnvironmentChanges.ParentReassigned);
     }
     ResetZ();
 }
示例#7
0
 protected void AddInstalledContent(params Content[] installedContent)
 {
     if (installedContent == null)
     {
         throw new ArgumentNullException(nameof(installedContent));
     }
     if (!(installedContent.Any()))
     {
         throw new ArgumentOutOfRangeException("installedContent.Any()");
     }
     Contents.AddRange(installedContent);
     PrepareEvent(new ContentInstalled(Id, installedContent));
 }
示例#8
0
        public void LoadBook(int bookId, bool append = false)
        {
            var epubBook = bookModel.OpenBook(bookId);

            Contents    = Contents.AddRange(bookModel.GetChapters(epubBook));
            images      = images.AddRange(epubBook.Content.Images.ToDictionary(imageFile => imageFile.Key, imageFile => imageFile.Value.Content));
            styleSheets = styleSheets.AddRange(epubBook.Content.Css.ToDictionary(cssFile => cssFile.Key, cssFile => cssFile.Value.Content));
            fonts       = fonts.AddRange(epubBook.Content.Fonts.ToDictionary(fontFile => fontFile.Key, fontFile => fontFile.Value.Content));

            selectChapterCommand   = null;
            selectedChapter        = null;
            selectedChapterContent = null;
            if (Contents.Any())
            {
                SelectChapter(Contents.First());
            }
        }
        public ElementBuilder(ElementType type,
                              params IContent[] contents)
        {
            Type = type;

            Contents.AddRange(contents);
            ContentType = Contents.Aggregate(
                ContentTypeEnum.None,
                (typeAcc,
                 content) => typeAcc | content.ContentType
                );

            ShouldDisplay = true;
            Title         = null;

            LinkedConceptsInternal = new List <IConcept>();
            ComponentsInternal     = new List <IComponent>();
        }
示例#10
0
        public ElementBuilder(ElementType type,
                              string layoutName = null,
                              params ContentBase[] contents)
        {
            Type = type;

            Layout = layoutName;

            if (contents != null)
            {
                Contents.AddRange(contents);
            }
            ContentType = Contents.Aggregate(
                ContentTypeFlag.None,
                (typeAcc,
                 content) => typeAcc | content.ContentType
                );

            Status        = ElementStatus.Memorized;
            ShouldDisplay = true;
            Title         = null;
        }
示例#11
0
文件: TagContent.cs 项目: i-e-b/T.g
        /// <summary>
        /// Supply the contents of the tag. These will not be rendered if `IsEmpty` is true.
        /// Additional tags will be added after existing ones.
        /// </summary>
        [NotNull] public TagContent Add(IEnumerable <TagContent> content)
        {
            if (content == null)
            {
                return(this);
            }

            IsEmpty = false;
            if (Contents == null)
            {
                Contents = new List <TagContent>();
            }

            if (Text != null)
            {
                Contents.Add(T.g()[Text]);
                Text = null;
            }
            Contents.AddRange(content);

            return(this);
        }
示例#12
0
        /// <summary>
        /// Takes all the leaf nodes and removes them, adding their contents to their parents and making their parents the new leaf.
        /// </summary>
        public void LiftLeafNodes(int newMinWidth, int newMinHeight)
        {
            _minWidth  = newMinWidth;
            _minHeight = newMinHeight;

            // If top left is a leaf, the rest are leafs too, meaning I am the new leaf
            if (Children[TOP_LEFT].Leaf)
            {
                List <Collidable> leafContents = new List <Collidable>();
                // Pull leaf node contents
                foreach (QuadTreeNode node in Children)
                {
                    leafContents.AddRange(node.Contents);
                }

                // Update leaf contents map referrences
                foreach (Collidable obj in leafContents)
                {
                    obj.SetMapArea(this);
                }

                // Remove Children
                Children.Clear();

                // Add my old children's contents to me
                Contents.AddRange(leafContents);

                // We are now a leaf
                Leaf = true;
            }
            else
            {
                Children[TOP_LEFT].LiftLeafNodes(_minWidth, _minHeight);
                Children[TOP_RIGHT].LiftLeafNodes(_minWidth, _minHeight);
                Children[BOTTOM_LEFT].LiftLeafNodes(_minWidth, _minHeight);
                Children[BOTTOM_RIGHT].LiftLeafNodes(_minWidth, _minHeight);
            }
        }
示例#13
0
 public void AddRange(String[] collection)
 {
     Contents.AddRange(collection);
     SaveList();
 }
示例#14
0
        public ActionResult UserNews(string userName)
        {
            _ua = new UserAccount(userName);

            ViewBag.UserName = _ua.UserName;

            var conts = new Contents();

            conts.GetContentForUser(_ua.UserAccountID);

            conts.IncludeStartAndEndTags = false;

            conts.Sort((x, y) => (y.ReleaseDate.CompareTo(x.ReleaseDate)));

            var contentToLoad = new Contents();
            contentToLoad.AddRange(conts.Where(content => content.ReleaseDate < DateTime.UtcNow));

            ViewBag.NewsCount = contentToLoad.Count;

            return View(contentToLoad);
        }
示例#15
0
 public DynamicTableView(IEnumerable <TSource> source, TableRenderOptions options = null) : this(options)
 {
     Contents.AddRange(source);
 }