private void GetBlocks(XElement curNode) { if (curNode.Name.Equals(Xns + "img")) { int id = ImageBlocks.Count; ImageBlock iBlock = new ImageBlock(id, curNode, this); ImageBlocks.Add(iBlock); curNode.SetAttributeValue("id", iBlock.B_ID); Blocks.Add(iBlock); } foreach (XNode childNode in curNode.Nodes()) { if (childNode is XText) { XText textNode = childNode as XText; int id = ContentBlocks.Count; String text = textNode.Value; ContentBlock cBlock = new ContentBlock(id, text, this); ContentBlocks.Add(cBlock); textNode.Value = cBlock.B_ID; Blocks.Add(cBlock); } else if (childNode is XElement) { GetBlocks(childNode as XElement); } } }
/// <summary> /// Add a new content block to this gadget /// </summary> /// <param name="content"></param> /// <returns></returns> public ContentBlock AddContentBlock(ContentBlock content) { content.MyRootMaster = this; ContentBlocks.Add(content); content.IncludeWrappingDivs = RenderingOptions.DivWrapContentBlocks; //check for reserved profile.left / profile.right and handle side effects string pmount; if (content.IsReservedProfileView(out pmount)) { this.MySpaceViewSettings.ProfileLocation = pmount; } return(content); }